cURL / Mailing Lists / curl-library / Single Mail

curl-library

memory leaks in global_init

From: <centrio_at_gmail.com>
Date: Thu, 22 Oct 2009 06:23:04 +0000

Hi,
I have a simple main program that is doing following things

#include <iostream>
#include <curl/curl.h>

using namespace std;

int main(int argc, char* argv[])
{
curl_global_init(CURL_GLOBAL_ALL||CURL_GLOBAL_SSL);
curl_global_cleanup();
}

I ran valgrind on this as
valgrind --tool=memcheck --num-callers=40 --show-reachable=yes
--leak-check=full sample 2>Valgrind.log

Here is the valgrind log :

==12093== Memcheck, a memory error detector.
==12093== Copyright (C) 2002-2006, and GNU GPL'd, by Julian Seward et al.
==12093== Using LibVEX rev 1658, a library for dynamic binary translation.
==12093== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP.
==12093== Using valgrind-3.2.2.SVN, a dynamic binary instrumentation
framework.
==12093== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et al.
==12093== For more details, rerun with: -v
==12093==
==12093==
==12093== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 5 from 1)
==12093== malloc/free: in use at exit: 844 bytes in 11 blocks.
==12093== malloc/free: 2,037 allocs, 2,026 frees, 35,018 bytes allocated.
==12093== For counts of detected errors, rerun with: -v
==12093== searching for pointers to 11 not-freed blocks.
==12093== checked 255,608 bytes.
==12093==
==12093== 844 bytes in 11 blocks are still reachable in loss record 1 of 1
==12093== at 0x40233F0: malloc (in
/usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==12093== by 0x40FF8B0: default_malloc_ex (mem.c:79)
==12093== by 0x40FFF2B: CRYPTO_malloc (mem.c:304)
==12093== by 0x416FEB1: ENGINE_new (eng_lib.c:68)
==12093== by 0x4175666: ENGINE_padlock (eng_padlock.c:195)
==12093== by 0x41754F7: ENGINE_load_padlock (eng_padlock.c:115)
==12093== by 0x4172DCB: ENGINE_load_builtin_engines (eng_all.c:72)
==12093== by 0x80D3F71: Curl_ossl_init (ssluse.c:596)
==12093== by 0x80C2139: Curl_ssl_init (sslgen.c:165)
==12093== by 0x80BBD86: curl_global_init (easy.c:255)
==12093== by 0x809E69A: main (Program.cpp:10)
==12093==
==12093== LEAK SUMMARY:
==12093== definitely lost: 0 bytes in 0 blocks.
==12093== possibly lost: 0 bytes in 0 blocks.
==12093== still reachable: 844 bytes in 11 blocks.
==12093== suppressed: 0 bytes in 0 blocks.
~

Please let me know if this is a genuine problem, or is there something that
i am doing wrong.
My lib versions are
curl : 7.19.0
linux-gate.so.1 => (0xffffe000)
libidn.so.11 => Idn-1.9.0/lib/libidn.so.11 (0xb7ed3000)
libssl.so.0.9.8 => openssl-0.9.8f/lib/libssl.so.0.9.8 (0xb7e8d000)
librt.so.1 => /lib/librt.so.1 (0xb7e65000)
libcrypto.so.0.9.8 => openssl-0.9.8f/lib/libcrypto.so.0.9.8 (0xb7d0d000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7c29000)
libm.so.6 => /lib/libm.so.6 (0xb7c03000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7bf7000)
libpthread.so.0 => /lib/libpthread.so.0 (0xb7bde000)
libc.so.6 => /lib/libc.so.6 (0xb7ab0000)
libefence.so.0 => /usr/lib/libefence.so.0 (0xb7aab000)
libdl.so.2 => /lib/libdl.so.2 (0xb7aa7000)
/lib/ld-linux.so.2 (0xb7f08000)

Regards
Shivanand

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-10-22