Hi, I'm currently developping an application using libcrypto, I find some
memory leak with valgrind (please don't say me to compile with -DPURIFY, I
know that and in fact, my problem is not uninitialized data, but rather
memory leak) :

==26823== 1,552 (168 direct, 1,384 indirect) bytes in 1 blocks are
definitely lost in loss record 1 of 2
==26823==    at 0x4C22FAB: malloc (vg_replace_malloc.c:207)
==26823==    by 0x40ACB2: CRYPTO_malloc (in /home/nicolas/admkey)
==26823==    by 0x41CBBA: RSA_new_method (in /home/nicolas/admkey)
==26823==    by 0x41CECC: rsa_cb (in /home/nicolas/admkey)
==26823==    by 0x428C02: asn1_item_ex_combine_new (in /home/nicolas/admkey)
==26823==    by 0x42BC17: ASN1_item_ex_d2i (in /home/nicolas/admkey)
==26823==    by 0x42BD13: ASN1_item_d2i (in /home/nicolas/admkey)
==26823==    by 0x4284E3: d2i_PrivateKey (in /home/nicolas/admkey)
==26823==    by 0x4097F7: PEM_read_bio_PrivateKey (in /home/nicolas/admkey)
==26823==    by 0x409A30: PEM_read_PrivateKey (in /home/nicolas/admkey)
==26823==    by 0x40953E: PEM_read_RSAPrivateKey (in /home/nicolas/admkey)
==26823==    by 0x401CE5: change_passphrase (admkey.c:133)
==26823==
==26823==
==26823== 1,384 bytes in 16 blocks are indirectly lost in loss record 2 of 2
==26823==    at 0x4C22FAB: malloc (vg_replace_malloc.c:207)
==26823==    by 0x40ACB2: CRYPTO_malloc (in /home/nicolas/admkey)
==26823==    by 0x413F37: BN_new (in /home/nicolas/admkey)
==26823==    by 0x4271A4: bn_c2i (in /home/nicolas/admkey)
==26823==    by 0x42A069: asn1_ex_c2i (in /home/nicolas/admkey)
==26823==    by 0x42AB56: asn1_d2i_ex_primitive (in /home/nicolas/admkey)
==26823==    by 0x42B875: ASN1_item_ex_d2i (in /home/nicolas/admkey)
==26823==    by 0x42AF37: asn1_template_noexp_d2i (in /home/nicolas/admkey)
==26823==    by 0x42B1FE: asn1_template_ex_d2i (in /home/nicolas/admkey)
==26823==    by 0x42B9CC: ASN1_item_ex_d2i (in /home/nicolas/admkey)
==26823==    by 0x42BD13: ASN1_item_d2i (in /home/nicolas/admkey)
==26823==    by 0x4284E3: d2i_PrivateKey (in /home/nicolas/admkey)

I call PEM_read_RSAPrivateKey() as you can see, I've tried lots of solution
including call to these function :
EVP_cleanup ();
ERR_free_strings ();
CRYPTO_cleanup_all_ex_data ();
but valgrind still complains. I've also downloaded the latest snapshot, but
it seems that this problem is not currently fix.
I have also check in the documentation of PEM_read_RSAPrivateKey(), but
nothing says how to free this memory.
Please can someone help me, cause it's not acceptable for me.
Thanks!!!

Reply via email to