cURL / Mailing Lists / curl-library / Single Mail

curl-library

question about memory leak with curl-7.16.2 and openssl-0.9.8e

From: Peter Wilkes <pwilkes_at_cowpie.acm.vt.edu>
Date: Fri, 13 Apr 2007 14:08:41 -0400 (EDT)

hello,

i'm using curl-7.16.2 and openssl-0.9.8e to perform HTTP requests in my
application.

i am trying to set up a curl connection that will post data over an SSL
connection, with custom headers. im slightly confused. according to my
debugger i'm leaking memory on every connection. i'm not really sure if
it is the way my code is written or internal to curl or internal to
openssl. i am on a windows xp environment.

i do call curl_global_init once in the application. and i do call
curl_global_cleanup once in the application.

i've condensed my code by removing the return code tests. i would very
much appreciate if someone knew if i was doing something wrong with the
way i call curl told me what exactly im missing. ive been over the
documentation a dozen times.

CURL *conn = NULL;
conn = curl_easy_init();
curl_easy_setopt(conn, CURLOPT_ERRORBUFFER, errorBuffer);
curl_easy_setopt(conn, CURLOPT_NOPROGRESS, 0);
curl_easy_setopt(conn, CURLOPT_PROGRESSFUNCTION, idleCallbackFunction);
curl_easy_setopt(conn, CURLOPT_PROGRESSDATA, idleCallbackData);
curl_easy_setopt(conn, CURLOPT_URL, url);
curl_easy_setopt(conn, CURLOPT_SSL_VERIFYPEER, 0);
curl_easy_setopt(conn, CURLOPT_SSL_VERIFYHOST, 0);
curl_easy_setopt(conn, CURLOPT_PORT, port);
curl_easy_setopt(conn, CURLOPT_POST, 1);
curl_easy_setopt(conn, CURLOPT_POSTFIELDS, postData);
curl_easy_setopt(conn, CURLOPT_POSTFIELDSIZE, postSize);
curl_easy_setopt(conn, CURLOPT_HTTPHEADER, headerList);
curl_easy_setopt(conn, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(conn, CURLOPT_WRITEFUNCTION, writeFunction);
curl_easy_setopt(conn, CURLOPT_WRITEDATA, &buffer);
curl_easy_setopt(conn, CURLOPT_CONNECTTIMEOUT, CONNECT_TIMEOUT_TIME);
curl_easy_setopt(conn, CURLOPT_TIMEOUT, OPERATION_TIMEOUT_TIME);
curl_easy_perform(conn);
curl_easy_cleanup(conn);

according to my debugger. the call stack where the memory was allocated
looks like...
X509_verify_cert_error_string
CRYPTO_malloc
sk_new
sk_new_null
CRYPTO_set_ex_data_implementation
CRYPTO_set_ex_data_implementation
CRYPTO_new_ex_data
X509_CINF_free
ASN1_item_ex_new
ASN1_item_ex_new
ASN1_item_ex_d2i
ASN1_item_d2i
d2i_X509
ssl3_get_server_certificate
ssl3_connect
SSL_connect
ssl23_connect
ssl23_connect
SSL_connect
ssluse.c (1501): Curl_ossl_connect_step2
ssluse.c (1764): Curl_ossl_connect_common
ssluse.c (1805): Curl_ossl_connect
sslgen.c (210): Curl_ssl_connect
http.c (1514): Curl_http_connect
url.c (2470): Curl_protocol_connect
url.c (4090): SetupConnection
url.c (4190): Curl_async_resolved
transfer.c (2312): Curl_connect_host
transfer.c (2395): Curl_perform
easy.c (489): curl_easy_perform
mycurlcode.cpp (101): dohttp

if anyone is able to help i very much appreciate it.
Received on 2007-04-13