8025669: [parfait] warning from b62 for jdk.src.solaris.native.com.sun.security.auth.module: memory leak

Reviewed-by: alanb, chegar
This commit is contained in:
Vinnie Ryan 2014-02-05 18:37:42 +00:00
parent 5475110b72
commit aef65cc369

View File

@ -75,11 +75,12 @@ Java_com_sun_security_auth_module_SolarisSystem_getSolarisInfo
if (fid == 0) { if (fid == 0) {
(*env)->ExceptionClear(env); (*env)->ExceptionClear(env);
throwIllegalArgumentException(env, "invalid field: username"); throwIllegalArgumentException(env, "invalid field: username");
return; goto cleanupAndReturn;
} }
jstr = (*env)->NewStringUTF(env, pwd.pw_name); jstr = (*env)->NewStringUTF(env, pwd.pw_name);
if (jstr == NULL) if (jstr == NULL) {
return; goto cleanupAndReturn;
}
(*env)->SetObjectField(env, obj, fid, jstr); (*env)->SetObjectField(env, obj, fid, jstr);
/* /*
@ -89,7 +90,7 @@ Java_com_sun_security_auth_module_SolarisSystem_getSolarisInfo
if (fid == 0) { if (fid == 0) {
(*env)->ExceptionClear(env); (*env)->ExceptionClear(env);
throwIllegalArgumentException(env, "invalid field: uid"); throwIllegalArgumentException(env, "invalid field: uid");
return; goto cleanupAndReturn;
} }
(*env)->SetLongField(env, obj, fid, pwd.pw_uid); (*env)->SetLongField(env, obj, fid, pwd.pw_uid);
@ -100,7 +101,7 @@ Java_com_sun_security_auth_module_SolarisSystem_getSolarisInfo
if (fid == 0) { if (fid == 0) {
(*env)->ExceptionClear(env); (*env)->ExceptionClear(env);
throwIllegalArgumentException(env, "invalid field: gid"); throwIllegalArgumentException(env, "invalid field: gid");
return; goto cleanupAndReturn;
} }
(*env)->SetLongField(env, obj, fid, pwd.pw_gid); (*env)->SetLongField(env, obj, fid, pwd.pw_gid);
@ -111,19 +112,24 @@ Java_com_sun_security_auth_module_SolarisSystem_getSolarisInfo
if (fid == 0) { if (fid == 0) {
(*env)->ExceptionClear(env); (*env)->ExceptionClear(env);
throwIllegalArgumentException(env, "invalid field: groups"); throwIllegalArgumentException(env, "invalid field: groups");
return; goto cleanupAndReturn;
} }
jgroups = (*env)->NewLongArray(env, numSuppGroups); jgroups = (*env)->NewLongArray(env, numSuppGroups);
if (jgroups == NULL) if (jgroups == NULL) {
return; goto cleanupAndReturn;
}
jgroupsAsArray = (*env)->GetLongArrayElements(env, jgroups, 0); jgroupsAsArray = (*env)->GetLongArrayElements(env, jgroups, 0);
if (jgroupsAsArray == NULL) if (jgroupsAsArray == NULL) {
return; goto cleanupAndReturn;
}
for (i = 0; i < numSuppGroups; i++) for (i = 0; i < numSuppGroups; i++)
jgroupsAsArray[i] = groups[i]; jgroupsAsArray[i] = groups[i];
(*env)->ReleaseLongArrayElements(env, jgroups, jgroupsAsArray, 0); (*env)->ReleaseLongArrayElements(env, jgroups, jgroupsAsArray, 0);
(*env)->SetObjectField(env, obj, fid, jgroups); (*env)->SetObjectField(env, obj, fid, jgroups);
} }
cleanupAndReturn:
free(groups);
return; return;
} }