[krbdev.mit.edu #8699] Resource leak in k5_os_hostaddr()

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[krbdev.mit.edu #8699] Resource leak in k5_os_hostaddr()

Norm Green via RT
Hi Team,

k5_os_hostaddr() in krb5-1.16.1/src/lib/krb5/os/hostaddr.c
calls getaddrinfo(name, 0, &hints, &ai) to get the addr info and store allocated memory to pointer "ai"
later if fails to call malloc((i+1) * sizeof(*addrs)), function directly return without freeing the storage ai points to.

The fix is to call "retval = ENOMEM; goto errout;" instead of "return ENOMEM;"

Could someone help to take a look?


krb5-bugs mailing list
[hidden email]