8204667: Resources not freed on exception

Reviewed-by: skoivu, chegar
This commit is contained in:
Ivan Gerasimov 2018-06-20 18:02:22 -07:00
parent e8fc5de2ab
commit d686431d78
3 changed files with 42 additions and 17 deletions

View file

@ -358,7 +358,9 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0
int address1 = htonl(
((struct sockaddr_in *)addrP->addr)->sin_addr.s_addr);
int address2 = getInetAddress_addr(env, iaObj);
JNU_CHECK_EXCEPTION_RETURN(env, NULL);
if ((*env)->ExceptionCheck(env)) {
goto cleanup;
}
if (address1 == address2) {
match = JNI_TRUE;
break;
@ -404,6 +406,7 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0
obj = createNetworkInterface(env, curr);
}
cleanup:
// release the interface list
freeif(ifs);