src/java.base/windows/native/libnet/NetworkInterface.c
changeset 51562 1b1bca603244
parent 51151 d6b131d2bc8b
child 52167 b1db57cfe6bd
--- 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;
         }