curl-library
some CURLOPT_WRITEFUNCTION callback arguments being flagged as undefined by valgrind
Date: Mon, 02 Apr 2012 18:11:48 +1000
I'm having to use VALGRIND_MAKE_MEM_DEFINED on some values passed to my
callback by libcurl. If I don't do this, I get hundreds of errors
flagged by valgrind regarding referencing the indicated values or
derived values.
Has anyone any idea about why this might be happening? Do you think my
use of VALGRIND_MAKE_MEM_DEFINED in this manner is safe? It seems to be
as no other issues are reported and the applications functions just fine.
I'm setting up the callbacks for CURLOPT_WRITEFUNCTION and
CURLOPT_HEADERFUNCTION:
curl_easy_setopt(net->curl, CURLOPT_WRITEDATA, myobj);
curl_easy_setopt(net->curl, CURLOPT_WRITEFUNCTION,
(curl_write_callback) _write_data_callback);
curl_easy_setopt(net->curl, CURLOPT_WRITEHEADER, myobj);
curl_easy_setopt(net->curl, CURLOPT_HEADERFUNCTION,
(curl_write_callback) _write_hdr_callback);
my "data" callback is (hdr is similar):
staticsize_t _write_data_callback(char*buffer, size_t size, size_t
nitems, struct myStruct *myobj)
{
VALGRIND_MAKE_MEM_DEFINED(&nmemb, sizeof(nitems));
VALGRIND_MAKE_MEM_DEFINED(buffer, size * nitems);
return_write_hdr_response(myobj, buffer, size, nitems);
}
thanks
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-04-02