# HG changeset patch # User mbaesken # Date 1535439714 -7200 # Node ID 1b1bca603244b78543d577287415d5236b044054 # Parent 67092c6be8e1ee56cd80fd16a0c70e2a69a0241b 8209994: windows: Java_java_net_NetworkInterface_getAll misses releasing interface-list Reviewed-by: bpb, chegar, simonis diff -r 67092c6be8e1 -r 1b1bca603244 src/java.base/windows/native/libnet/NetworkInterface.c --- a/src/java.base/windows/native/libnet/NetworkInterface.c Tue Aug 28 20:05:41 2018 -0700 +++ b/src/java.base/windows/native/libnet/NetworkInterface.c Tue Aug 28 09:01:54 2018 +0200 @@ -826,7 +826,7 @@ (JNIEnv *env, jclass cls) { int count; - netif *ifList, *curr; + netif *ifList = NULL, *curr; jobjectArray netIFArr; jint arr_index; @@ -846,6 +846,7 @@ /* allocate a NetworkInterface array */ netIFArr = (*env)->NewObjectArray(env, count, cls, NULL); if (netIFArr == NULL) { + free_netif(ifList); return NULL; } @@ -860,6 +861,7 @@ netifObj = createNetworkInterface(env, curr, -1, NULL); if (netifObj == NULL) { + free_netif(ifList); return NULL; } diff -r 67092c6be8e1 -r 1b1bca603244 src/java.base/windows/native/libnet/NetworkInterface_winXP.c --- a/src/java.base/windows/native/libnet/NetworkInterface_winXP.c Tue Aug 28 20:05:41 2018 -0700 +++ b/src/java.base/windows/native/libnet/NetworkInterface_winXP.c Tue Aug 28 09:01:54 2018 +0200 @@ -784,7 +784,7 @@ (JNIEnv *env, jclass cls) { int count; - netif *ifList, *curr; + netif *ifList = NULL, *curr; jobjectArray netIFArr; jint arr_index; @@ -799,6 +799,7 @@ /* allocate a NetworkInterface array */ netIFArr = (*env)->NewObjectArray(env, count, cls, NULL); if (netIFArr == NULL) { + free_netif(ifList); return NULL; } @@ -813,6 +814,7 @@ netifObj = createNetworkInterfaceXP(env, curr); if (netifObj == NULL) { + free_netif(ifList); return NULL; }