Skip Menu |
 

Subject: Memory leak in krb5_cc_resolve (double malloc of pfx)
There is a 7 byte memory leak (strlen("MEMORY")+1) when passing a cache
name that is formatted with the "type:" field.

I was doing this:

cc_resolve(ctx, "/tmp/myfile.cache", &cache)

and all was fine. But then I decided that a MEMORY cache best fit my
needs, so I tried:

cc_resolve(ctx, "MEMORY:/tmp/myfile.cache", &cache)

And found a leak with valgrind. Its the size of the type string, I then
found the dual allocation.

ccbase.c:110 allocates 7 bytes of memory

ccbase.c:127 allocates over the first allocation (in the case where my
prefix length is greater then 1).
I downloaded a 1.3.5 snapshot, and this bug seems to be fixed (only a
single malloc()).. I did a bugsearch before I logged it, but apparently
I missed it (or it wasn't logged).
Fixed on trunk. There appears to have been a botched merge on the
1.3-branch causing the leak.