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

John Zavgren john.zavgren at oracle.com
Fri Oct 19 20:28:41 UTC 2012


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