possible memory leak with heimdal

Love Hörnquist Åstrand lha at kth.se
Tue Sep 28 23:38:57 MDT 2010


> 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

This is you that free a static string.

> ==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)

I don't understand this leak.

> ==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)

These should be fixed with

http://github.com/heimdal/heimdal/commit/54106143305ffd56fb12215a7462f1af86de9e64
http://github.com/heimdal/heimdal/commit/97d939d9af0abef07a68ebc6cdec803bcdbf1c4e	

Love

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3815 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20100929/350ed84b/attachment.bin>


More information about the samba-technical mailing list