curl-library
curl_global_init() and curl_global_cleanup() Results in Memory Leaks
Date: Thu, 27 Aug 2009 13:07:07 +0300
Hi all!
Calling curl_global_init() and curl_global_cleanup() (as demonstrated in the
attached source) results in memory leaks (at least according to valgrind) on
my Debian Testing VM, and my Fedora 11 (up-to-date) VM, and also possibly on
my Mandriva Cooker host.
I am invoking valgrind like this:
{{{{{{{{{{{{{
#!/bin/sh
valgrind --tool=memcheck --leak-check=full --leak-resolution=high \
--num-callers=20 --log-file=val.txt --leak-check=full \
--show-reachable=yes ./curl-test
}}}}}}}}}}}}}
And am getting the following output:
{{{{{{{{{{{{{
==2671== Memcheck, a memory error detector.
==2671== Copyright (C) 2002-2008, and GNU GPL'd, by Julian Seward et al.
==2671== Using LibVEX rev 1884, a library for dynamic binary translation.
==2671== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP.
==2671== Using valgrind-3.4.1-Debian, a dynamic binary instrumentation
framework.
==2671== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al.
==2671== For more details, rerun with: -v
==2671==
==2671== My PID = 2671, parent PID = 2383. Prog and args are:
==2671== ./curl-test
==2671==
==2671==
==2671== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 57 from 1)
==2671== malloc/free: in use at exit: 864 bytes in 12 blocks.
==2671== malloc/free: 2,095 allocs, 2,083 frees, 35,573 bytes allocated.
==2671== For counts of detected errors, rerun with: -v
==2671== searching for pointers to 12 not-freed blocks.
==2671== checked 356,172 bytes.
==2671==
==2671== 4 bytes in 1 blocks are still reachable in loss record 1 of 12
==2671== at 0x402601E: malloc (vg_replace_malloc.c:207)
==2671== by 0x4343C3D: (within /usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43442EE: CRYPTO_malloc (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x439D179: engine_cleanup_add_last (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x439DC42: ENGINE_add (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43A35D2: ENGINE_load_padlock (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x439FB56: ENGINE_load_builtin_engines (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x40535A6: (within /usr/lib/libcurl.so.4.1.1)
==2671== by 0x406816B: (within /usr/lib/libcurl.so.4.1.1)
==2671== by 0x405D30C: curl_global_init (in /usr/lib/libcurl.so.4.1.1)
==2671== by 0x80485B8: main (curl-test.c:19)
==2671==
==2671==
==2671== 12 bytes in 1 blocks are still reachable in loss record 2 of 12
==2671== at 0x402601E: malloc (vg_replace_malloc.c:207)
==2671== by 0x4343C3D: (within /usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43442EE: CRYPTO_malloc (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x42EBC9F: (within /usr/lib/i686/cmov/libssl.so.0.9.8)
==2671== by 0x42EBED6: SSL_COMP_get_compression_methods (in
/usr/lib/i686/cmov/libssl.so.0.9.8)
==2671== by 0x42F20B4: SSL_library_init (in
/usr/lib/i686/cmov/libssl.so.0.9.8)
==2671== by 0x40535B0: (within /usr/lib/libcurl.so.4.1.1)
==2671== by 0x406816B: (within /usr/lib/libcurl.so.4.1.1)
==2671== by 0x405D30C: curl_global_init (in /usr/lib/libcurl.so.4.1.1)
==2671== by 0x80485B8: main (curl-test.c:19)
==2671==
==2671==
==2671== 12 bytes in 1 blocks are still reachable in loss record 3 of 12
==2671== at 0x402601E: malloc (vg_replace_malloc.c:207)
==2671== by 0x4343C3D: (within /usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43442EE: CRYPTO_malloc (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43AF9B0: lh_insert (in /usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43B4168: (within /usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43B3315: ERR_get_state (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43B2057: ERR_clear_error (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43A35DF: ENGINE_load_padlock (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x439FB56: ENGINE_load_builtin_engines (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x40535A6: (within /usr/lib/libcurl.so.4.1.1)
==2671== by 0x406816B: (within /usr/lib/libcurl.so.4.1.1)
==2671== by 0x405D30C: curl_global_init (in /usr/lib/libcurl.so.4.1.1)
==2671== by 0x80485B8: main (curl-test.c:19)
==2671==
==2671==
==2671== 16 bytes in 1 blocks are still reachable in loss record 4 of 12
==2671== at 0x402601E: malloc (vg_replace_malloc.c:207)
==2671== by 0x4343C3D: (within /usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43442EE: CRYPTO_malloc (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43AF0A5: sk_new (in /usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x42EBC7D: (within /usr/lib/i686/cmov/libssl.so.0.9.8)
==2671== by 0x42EBED6: SSL_COMP_get_compression_methods (in
/usr/lib/i686/cmov/libssl.so.0.9.8)
==2671== by 0x42F20B4: SSL_library_init (in
/usr/lib/i686/cmov/libssl.so.0.9.8)
==2671== by 0x40535B0: (within /usr/lib/libcurl.so.4.1.1)
==2671== by 0x406816B: (within /usr/lib/libcurl.so.4.1.1)
==2671== by 0x405D30C: curl_global_init (in /usr/lib/libcurl.so.4.1.1)
==2671== by 0x80485B8: main (curl-test.c:19)
==2671==
==2671==
==2671== 16 bytes in 1 blocks are still reachable in loss record 5 of 12
==2671== at 0x402601E: malloc (vg_replace_malloc.c:207)
==2671== by 0x4343C3D: (within /usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43442EE: CRYPTO_malloc (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43AF0A5: sk_new (in /usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43AF12D: sk_new_null (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x439D1A4: engine_cleanup_add_last (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x439DC42: ENGINE_add (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43A35D2: ENGINE_load_padlock (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x439FB56: ENGINE_load_builtin_engines (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x40535A6: (within /usr/lib/libcurl.so.4.1.1)
==2671== by 0x406816B: (within /usr/lib/libcurl.so.4.1.1)
==2671== by 0x405D30C: curl_global_init (in /usr/lib/libcurl.so.4.1.1)
==2671== by 0x80485B8: main (curl-test.c:19)
==2671==
==2671==
==2671== 20 bytes in 1 blocks are still reachable in loss record 6 of 12
==2671== at 0x402601E: malloc (vg_replace_malloc.c:207)
==2671== by 0x4343C3D: (within /usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43442EE: CRYPTO_malloc (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43AF087: sk_new (in /usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x42EBC7D: (within /usr/lib/i686/cmov/libssl.so.0.9.8)
==2671== by 0x42EBED6: SSL_COMP_get_compression_methods (in
/usr/lib/i686/cmov/libssl.so.0.9.8)
==2671== by 0x42F20B4: SSL_library_init (in
/usr/lib/i686/cmov/libssl.so.0.9.8)
==2671== by 0x40535B0: (within /usr/lib/libcurl.so.4.1.1)
==2671== by 0x406816B: (within /usr/lib/libcurl.so.4.1.1)
==2671== by 0x405D30C: curl_global_init (in /usr/lib/libcurl.so.4.1.1)
==2671== by 0x80485B8: main (curl-test.c:19)
==2671==
==2671==
==2671== 20 bytes in 1 blocks are still reachable in loss record 7 of 12
==2671== at 0x402601E: malloc (vg_replace_malloc.c:207)
==2671== by 0x4343C3D: (within /usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43442EE: CRYPTO_malloc (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43AF087: sk_new (in /usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43AF12D: sk_new_null (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x439D1A4: engine_cleanup_add_last (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x439DC42: ENGINE_add (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43A35D2: ENGINE_load_padlock (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x439FB56: ENGINE_load_builtin_engines (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x40535A6: (within /usr/lib/libcurl.so.4.1.1)
==2671== by 0x406816B: (within /usr/lib/libcurl.so.4.1.1)
==2671== by 0x405D30C: curl_global_init (in /usr/lib/libcurl.so.4.1.1)
==2671== by 0x80485B8: main (curl-test.c:19)
==2671==
==2671==
==2671== 64 bytes in 1 blocks are still reachable in loss record 8 of 12
==2671== at 0x402601E: malloc (vg_replace_malloc.c:207)
==2671== by 0x4343C3D: (within /usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43442EE: CRYPTO_malloc (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43AF62C: lh_new (in /usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43B2FD9: (within /usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43B4129: (within /usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43B3315: ERR_get_state (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43B2057: ERR_clear_error (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43A35DF: ENGINE_load_padlock (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x439FB56: ENGINE_load_builtin_engines (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x40535A6: (within /usr/lib/libcurl.so.4.1.1)
==2671== by 0x406816B: (within /usr/lib/libcurl.so.4.1.1)
==2671== by 0x405D30C: curl_global_init (in /usr/lib/libcurl.so.4.1.1)
==2671== by 0x80485B8: main (curl-test.c:19)
==2671==
==2671==
==2671== 96 bytes in 1 blocks are still reachable in loss record 9 of 12
==2671== at 0x402601E: malloc (vg_replace_malloc.c:207)
==2671== by 0x4343C3D: (within /usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43442EE: CRYPTO_malloc (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43AF607: lh_new (in /usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43B2FD9: (within /usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43B4129: (within /usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43B3315: ERR_get_state (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43B2057: ERR_clear_error (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43A35DF: ENGINE_load_padlock (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x439FB56: ENGINE_load_builtin_engines (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x40535A6: (within /usr/lib/libcurl.so.4.1.1)
==2671== by 0x406816B: (within /usr/lib/libcurl.so.4.1.1)
==2671== by 0x405D30C: curl_global_init (in /usr/lib/libcurl.so.4.1.1)
==2671== by 0x80485B8: main (curl-test.c:19)
==2671==
==2671==
==2671== 104 bytes in 1 blocks are still reachable in loss record 10 of 12
==2671== at 0x402601E: malloc (vg_replace_malloc.c:207)
==2671== by 0x4343C3D: (within /usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43442EE: CRYPTO_malloc (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x439D3A7: ENGINE_new (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43A169B: ENGINE_load_dynamic (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x439FB5B: ENGINE_load_builtin_engines (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x40535A6: (within /usr/lib/libcurl.so.4.1.1)
==2671== by 0x406816B: (within /usr/lib/libcurl.so.4.1.1)
==2671== by 0x405D30C: curl_global_init (in /usr/lib/libcurl.so.4.1.1)
==2671== by 0x80485B8: main (curl-test.c:19)
==2671==
==2671==
==2671== 104 bytes in 1 blocks are still reachable in loss record 11 of 12
==2671== at 0x402601E: malloc (vg_replace_malloc.c:207)
==2671== by 0x4343C3D: (within /usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43442EE: CRYPTO_malloc (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x439D3A7: ENGINE_new (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43A35BB: ENGINE_load_padlock (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x439FB56: ENGINE_load_builtin_engines (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x40535A6: (within /usr/lib/libcurl.so.4.1.1)
==2671== by 0x406816B: (within /usr/lib/libcurl.so.4.1.1)
==2671== by 0x405D30C: curl_global_init (in /usr/lib/libcurl.so.4.1.1)
==2671== by 0x80485B8: main (curl-test.c:19)
==2671==
==2671==
==2671== 396 bytes in 1 blocks are still reachable in loss record 12 of 12
==2671== at 0x402601E: malloc (vg_replace_malloc.c:207)
==2671== by 0x4343C3D: (within /usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43442EE: CRYPTO_malloc (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43B31A3: ERR_get_state (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43B2057: ERR_clear_error (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x43A35DF: ENGINE_load_padlock (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x439FB56: ENGINE_load_builtin_engines (in
/usr/lib/i686/cmov/libcrypto.so.0.9.8)
==2671== by 0x40535A6: (within /usr/lib/libcurl.so.4.1.1)
==2671== by 0x406816B: (within /usr/lib/libcurl.so.4.1.1)
==2671== by 0x405D30C: curl_global_init (in /usr/lib/libcurl.so.4.1.1)
==2671== by 0x80485B8: main (curl-test.c:19)
==2671==
==2671== LEAK SUMMARY:
==2671== definitely lost: 0 bytes in 0 blocks.
==2671== possibly lost: 0 bytes in 0 blocks.
==2671== still reachable: 864 bytes in 12 blocks.
==2671== suppressed: 0 bytes in 0 blocks.
}}}}}}}}}}}}}
My libcurl packages on Debian are:
{{{{{{{{{{{{{
ii libcurl3 7.19.5-1 Multi-
protocol file transfer library (OpenSSL)
ii libcurl3-gnutls 7.19.5-1 Multi-
protocol file transfer library (GnuTLS)
ii libcurl4-openssl-dev 7.19.5-1
Development files and documentation for libcurl (OpenSSL)
}}}}}}}}}}}}}
Any help would be appreciated.
Regards,
Shlomi Fish
-- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ What does "Zionism" mean? - http://shlom.in/def-zionism God gave us two eyes and ten fingers so we will type five times as much as we read.
- text/x-csrc attachment: curl-test.c