cURL / Mailing Lists / curl-library / Single Mail

curl-library

Memory leaks

From: Marco André F. de Almeida <malmeida_at_netc.pt>
Date: Fri, 6 Oct 2006 17:04:24 +0100

Hello.
I'm trying to use libcurl for the first time.
I've just copy-pasted the simplest of the examples I found

11 #include <stdio.h>
12 #include <curl/curl.h>
13
14 int main(void)
15 {
16 CURL *curl;
17 CURLcode res;
18
19 curl = curl_easy_init();
20 if(curl) {
21 curl_easy_setopt(curl, CURLOPT_URL, "curl.haxx.se");
22 res = curl_easy_perform(curl);
23
24 /* always cleanup */
25 curl_easy_cleanup(curl);
26 }
27 return 0;
28 }

but when I run it trough valgrind, this is what I get:

==2875== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 29 from 1)
==2875== malloc/free: in use at exit: 27816 bytes in 1830 blocks.
==2875== malloc/free: 1937 allocs, 107 frees, 75554 bytes allocated.
==2875== For counts of detected errors, rerun with: -v
==2875== searching for pointers to 1830 not-freed blocks.
==2875== checked 228436 bytes.
==2875==
==2875== LEAK SUMMARY:
==2875== definitely lost: 84 bytes in 3 blocks.
==2875== possibly lost: 0 bytes in 0 blocks.
==2875== still reachable: 27732 bytes in 1827 blocks.
==2875== suppressed: 0 bytes in 0 blocks.
==2875== Use --leak-check=full to see details of leaked memory.

I already tried adding the global cleanup functions, but it still
has memory leaks.
Can somebody please help me?

Thanks,
Marco

Received on 2006-10-06