possible memory leak with heimdal

Matthieu Patou mat at samba.org
Tue Sep 28 17:02:35 MDT 2010


  Hi love,

I've run valgrind against a small heimdal tester program (cf. attached 
file).

I still have the following leak, I'm pretty sure I did what I should 
have done to avoid the leak (ie. freeing structures).

Could it be left over in your code ? or some stuff not cleaned when the 
parent structure is freed ?


==22987== Invalid free() / delete / delete[]
==22987==    at 0x4024B3A: free (vg_replace_malloc.c:366)
==22987==    by 0x476BB61: der_free_octet_string (der_free.c:117)
==22987==    by 0x804BAB9: main (heimdaltst.c:313)
==22987==  Address 0xbeba9e9b is on thread 1's stack
==22987==
==22987==
==22987== HEAP SUMMARY:
==22987==     in use at exit: 1,692 bytes in 14 blocks
==22987==   total heap usage: 13,637 allocs, 13,624 frees, 2,064,406 
bytes allocated
==22987==
==22987== 28 bytes in 1 blocks are definitely lost in loss record 1 of 7
==22987==    at 0x4024F20: malloc (vg_replace_malloc.c:236)
==22987==    by 0x476C7E9: der_copy_oid (der_copy.c:161)
==22987==    by 0x46F6FB2: copy_AlgorithmIdentifier 
(asn1_rfc2459_asn1.c:427)
==22987==    by 0x45F0082: hx509_cert_get_SPKI_AlgorithmIdentifier 
(cert.c:1506)
==22987==    by 0x804B831: main (heimdaltst.c:280)
==22987==
==22987== 128 bytes in 1 blocks are definitely lost in loss record 2 of 7
==22987==    at 0x4024F20: malloc (vg_replace_malloc.c:236)
==22987==    by 0x47FD5A9: mp_init (bn_mp_init.c:24)
==22987==    by 0x48072DC: mp_init_multi (bn_mp_init_multi.c:28)
==22987==    by 0x45A5A04: ltm_rsa_generate_key (rsa-ltm.c:516)
==22987==    by 0x45A3FD6: hc_RSA_generate_key_ex (rsa.c:475)
==22987==    by 0x804ABDC: create_key (heimdaltst.c:48)
==22987==    by 0x804AF8B: create_req (heimdaltst.c:116)
==22987==    by 0x804B791: main (heimdaltst.c:275)
==22987==
==22987== 128 bytes in 1 blocks are definitely lost in loss record 3 of 7
==22987==    at 0x4024F20: malloc (vg_replace_malloc.c:236)
==22987==    by 0x47FD5A9: mp_init (bn_mp_init.c:24)
==22987==    by 0x480099C: mp_mod (bn_mp_mod.c:25)
==22987==    by 0x45A482F: setup_blind (rsa-ltm.c:82)
==22987==    by 0x45A5577: ltm_rsa_private_decrypt (rsa-ltm.c:409)
==22987==    by 0x45A3B6E: hc_RSA_private_decrypt (rsa.c:321)
==22987==    by 0x45F885F: _hx509_private_key_private_decrypt 
(crypto.c:1654)
==22987==    by 0x804B8BA: main (heimdaltst.c:284)
==22987==
==22987== 128 bytes in 1 blocks are definitely lost in loss record 4 of 7
==22987==    at 0x4024F20: malloc (vg_replace_malloc.c:236)
==22987==    by 0x47FD5A9: mp_init (bn_mp_init.c:24)
==22987==    by 0x48072DC: mp_init_multi (bn_mp_init_multi.c:28)
==22987==    by 0x4801A35: fast_mp_invmod (bn_fast_mp_invmod.c:35)
==22987==    by 0x4801E5E: mp_invmod (bn_mp_invmod.c:29)
==22987==    by 0x45A4848: setup_blind (rsa-ltm.c:83)
==22987==    by 0x45A5577: ltm_rsa_private_decrypt (rsa-ltm.c:409)
==22987==    by 0x45A3B6E: hc_RSA_private_decrypt (rsa.c:321)
==22987==    by 0x45F885F: _hx509_private_key_private_decrypt 
(crypto.c:1654)
==22987==    by 0x804B8BA: main (heimdaltst.c:284)
==22987==
==22987== 256 bytes in 2 blocks are definitely lost in loss record 5 of 7
==22987==    at 0x4024F20: malloc (vg_replace_malloc.c:236)
==22987==    by 0x47FD5A9: mp_init (bn_mp_init.c:24)
==22987==    by 0x4804868: mp_isprime (bn_mp_isprime.c:66)
==22987==    by 0x48047D2: mp_find_prime (bn_mp_find_prime.c:18)
==22987==    by 0x45A5A60: ltm_rsa_generate_key (rsa-ltm.c:525)
==22987==    by 0x45A3FD6: hc_RSA_generate_key_ex (rsa.c:475)
==22987==    by 0x804ABDC: create_key (heimdaltst.c:48)
==22987==    by 0x804AF8B: create_req (heimdaltst.c:116)
==22987==    by 0x804B791: main (heimdaltst.c:275)
==22987==
==22987== 256 bytes in 2 blocks are definitely lost in loss record 6 of 7
==22987==    at 0x4024F20: malloc (vg_replace_malloc.c:236)
==22987==    by 0x47FD5A9: mp_init (bn_mp_init.c:24)
==22987==    by 0x48072DC: mp_init_multi (bn_mp_init_multi.c:28)
==22987==    by 0x45A4AD3: ltm_rsa_public_encrypt (rsa-ltm.c:155)
==22987==    by 0x45A3ACF: hc_RSA_public_encrypt (rsa.c:318)
==22987==    by 0x45F868A: _hx509_public_encrypt (crypto.c:1604)
==22987==    by 0x45F02FB: _hx509_cert_public_encrypt (cert.c:1624)
==22987==    by 0x804B884: main (heimdaltst.c:283)
==22987==
==22987== 768 bytes in 6 blocks are definitely lost in loss record 7 of 7
==22987==    at 0x4024F20: malloc (vg_replace_malloc.c:236)
==22987==    by 0x47FD5A9: mp_init (bn_mp_init.c:24)
==22987==    by 0x4804868: mp_isprime (bn_mp_isprime.c:66)
==22987==    by 0x48047D2: mp_find_prime (bn_mp_find_prime.c:18)
==22987==    by 0x45A5B31: ltm_rsa_generate_key (rsa-ltm.c:537)
==22987==    by 0x45A3FD6: hc_RSA_generate_key_ex (rsa.c:475)
==22987==    by 0x804ABDC: create_key (heimdaltst.c:48)
==22987==    by 0x804AF8B: create_req (heimdaltst.c:116)
==22987==    by 0x804B791: main (heimdaltst.c:275)
==22987==
==22987== LEAK SUMMARY:
==22987==    definitely lost: 1,692 bytes in 14 blocks
==22987==    indirectly lost: 0 bytes in 0 blocks
==22987==      possibly lost: 0 bytes in 0 blocks
==22987==    still reachable: 0 bytes in 0 blocks
==22987==         suppressed: 0 bytes in 0 blocks
==22987==
==22987== For counts of detected and suppressed errors, rerun with: -v
==22987== ERROR SUMMARY: 8 errors from 8 contexts (suppressed: 63 from 10)


Matthieu.

-- 
Matthieu Patou
Samba Team        http://samba.org


-------------- next part --------------
A non-text attachment was scrubbed...
Name: heimdaltst.c
Type: text/x-csrc
Size: 9112 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20100929/b16e592c/attachment.c>


More information about the samba-technical mailing list