curl-library
Re: Memory leak in a libcurl with mbedtls
Date: Fri, 18 Mar 2016 09:28:47 +0100 (CET)
On Thu, 17 Mar 2016, Mindaugas Jaraminas wrote:
> Valgrind is reporting memory leaks in libcurl when it is used with a mbedtls
Thanks for your report!
Can you rebuild libcurl with debug symbols to get more details?
> ==2036== at 0x4C2CC70: calloc (in
> /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==2036== by 0x505B29B: ssl_append_key_cert (in
> /home/mindaugas/.../mbedtls-2.2.1/install/lib/libmbedtls.so.10)
> ==2036== by 0x40D7E4: mbedtls_connect_common (in
> /home/mindaugas/.../curl-7.47.1/docs/examples/https)
I don't understand this backtrace. 'mbedtls_connect_common' is a function in
libcurl, but I don't see how it uses any 'ssl_append_key_cert' function?
> ==2036== at 0x4C2CC70: calloc (in
> /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
...
> ==2036== by 0x54B3288: mbedtls_pk_parse_keyfile (in
> /home/mindaugas/.../mbedtls-2.2.1/install/lib/libmbedcrypto.so.0)
> ==2036== by 0x40D0F3: mbedtls_connect_common (in
> /home/mindaugas/.../curl-7.47.1/docs/examples/https)
This has to be mbedtls.c:270 that calls mbedtls_pk_parse_keyfile().
That memory is supposed to be freed again in Curl_mbedtls_close(), line 668
where mbedtls_pk_free() is called. Doesn't that happen?
-- / daniel.haxx.se ------------------------------------------------------------------- List admin: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.htmlReceived on 2016-03-18