cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Memory leak in a libcurl with mbedtls

From: Mindaugas Jaraminas <minde.j_at_gmail.com>
Date: Mon, 21 Mar 2016 16:15:54 +0200

Hi

I have found a solution.

This patch:
https://github.com/curl/curl/commit/c62d7944cf75f402d45523e3e415e44e83f5d733?diff=unified
Fixes the memory leak.

To test a you can use: valgrind --tool=memcheck --leak-check=yes
--read-inline-info=yes --num-callers=40 ./src/curl https://exmaple.com --cert
test_cert.pem --key test_key.pem

-- 
Best regards
MJ
On Fri, Mar 18, 2016 at 11:22 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Fri, 18 Mar 2016, Mindaugas Jaraminas wrote:
>
> Here full libs with debugging symbols
>>
>
> Did you check if Curl_mbedtls_close() is called properly?
>
> Can you figure out why the lines
>
>   mbedtls_pk_free(&conn->ssl[sockindex].pk);
>   mbedtls_x509_crt_free(&conn->ssl[sockindex].clicert);
>
> aren't enough to free this data?
>
> I failed to reproduce this leak (using libcurl from git and
> mbedTLS/2.2.1), which I guess is because I don't have any HTTPS sites that
> actually wants/uses client certificates:
>
> $ valgrind ./src/curl https://example.com/ --cert test_cert.pem --key
> test_key.pem
>
>
> --
>
>  / daniel.haxx.se
> -------------------------------------------------------------------
> List admin: https://cool.haxx.se/list/listinfo/curl-library
> Etiquette:  https://curl.haxx.se/mail/etiquette.html
>

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-03-22