# HG changeset patch # User vinnie # Date 1391625462 0 # Node ID 30164afa0211de62c7b57708f5f88eac0d5c84d2 # Parent 654c573cb341cf4166a7e9f0e713543b7a70651f 8025669: [parfait] warning from b62 for jdk.src.solaris.native.com.sun.security.auth.module: memory leak Reviewed-by: alanb, chegar diff -r 654c573cb341 -r 30164afa0211 jdk/src/solaris/native/com/sun/security/auth/module/Solaris.c --- a/jdk/src/solaris/native/com/sun/security/auth/module/Solaris.c Wed Feb 05 10:21:18 2014 -0800 +++ b/jdk/src/solaris/native/com/sun/security/auth/module/Solaris.c Wed Feb 05 18:37:42 2014 +0000 @@ -75,11 +75,12 @@ if (fid == 0) { (*env)->ExceptionClear(env); throwIllegalArgumentException(env, "invalid field: username"); - return; + goto cleanupAndReturn; } jstr = (*env)->NewStringUTF(env, pwd.pw_name); - if (jstr == NULL) - return; + if (jstr == NULL) { + goto cleanupAndReturn; + } (*env)->SetObjectField(env, obj, fid, jstr); /* @@ -89,7 +90,7 @@ if (fid == 0) { (*env)->ExceptionClear(env); throwIllegalArgumentException(env, "invalid field: uid"); - return; + goto cleanupAndReturn; } (*env)->SetLongField(env, obj, fid, pwd.pw_uid); @@ -100,7 +101,7 @@ if (fid == 0) { (*env)->ExceptionClear(env); throwIllegalArgumentException(env, "invalid field: gid"); - return; + goto cleanupAndReturn; } (*env)->SetLongField(env, obj, fid, pwd.pw_gid); @@ -111,19 +112,24 @@ if (fid == 0) { (*env)->ExceptionClear(env); throwIllegalArgumentException(env, "invalid field: groups"); - return; + goto cleanupAndReturn; } jgroups = (*env)->NewLongArray(env, numSuppGroups); - if (jgroups == NULL) - return; + if (jgroups == NULL) { + goto cleanupAndReturn; + } jgroupsAsArray = (*env)->GetLongArrayElements(env, jgroups, 0); - if (jgroupsAsArray == NULL) - return; + if (jgroupsAsArray == NULL) { + goto cleanupAndReturn; + } for (i = 0; i < numSuppGroups; i++) jgroupsAsArray[i] = groups[i]; (*env)->ReleaseLongArrayElements(env, jgroups, jgroupsAsArray, 0); (*env)->SetObjectField(env, obj, fid, jgroups); } +cleanupAndReturn: + free(groups); + return; }