Memory leak fix for: src/solaris/native/com/sun/security/auth/module/Unix.c

Brad Wetmore bradford.wetmore at oracle.com
Sat Oct 20 00:11:02 UTC 2012


Looks good, taken in isolation.

Just to be sure, are there any other methods that might return some 
object that has to be freed.

Brad


On 10/19/2012 1:28 PM, John Zavgren wrote:
> Greetings:
> The following webrev image contains a fix for a memory leak that occurs in the procedure: Java_com_sun_security_auth_module_UnixSystem_getUnixInfo (JNIEnv *env, jobject obj) in the file: jdk/src/solaris/native/com/sun/security/auth/module/Unix.c
>
> http://cr.openjdk.java.net/~khazra/john/8000204/webrev/
>
> The leaked memory is associated with the pointer named "groups": gid_t *groups = (gid_t *)calloc(numSuppGroups, sizeof(gid_t));
>
> The procedure in question exits in many places and in every case it's necessary to deallocate this memory. The leak occurred because returns were being made without freeing it. I fixed the leak by modifying the code so that there is a common "exit point", that is reached from these same places via goto statements, that performs this common function, immediately before the "return" statement.
>
> Thanks!
> John Zavgren
> john.zavgren at oracle.com
>



More information about the security-dev mailing list