mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-02-20 17:52:46 +00:00
fix missing DeleteLocalRef in loops
This commit is contained in:
parent
dd1b52c7d9
commit
703f9290c9
@ -608,6 +608,8 @@ jobject newPeer(JNIEnv *env, const ZT_Peer &peer)
|
||||
LOGE("exception assigning PeerPhysicalPath to array");
|
||||
break;
|
||||
}
|
||||
|
||||
env->DeleteLocalRef(path);
|
||||
}
|
||||
|
||||
env->SetObjectField(peerObject, pathsField, arrayObject);
|
||||
@ -809,6 +811,8 @@ jobject newNetworkConfig(JNIEnv *env, const ZT_VirtualNetworkConfig &vnetConfig)
|
||||
LOGE("Error assigning InetSocketAddress to array");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
env->DeleteLocalRef(inetAddrObj);
|
||||
}
|
||||
|
||||
env->SetObjectField(vnetConfigObj, assignedAddressesField, assignedAddrArrayObj);
|
||||
@ -837,6 +841,8 @@ jobject newNetworkConfig(JNIEnv *env, const ZT_VirtualNetworkConfig &vnetConfig)
|
||||
LOGE("Error assigning VirtualNetworkRoute to array");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
env->DeleteLocalRef(routeObj);
|
||||
}
|
||||
|
||||
env->SetObjectField(vnetConfigObj, routesField, routesArrayObj);
|
||||
|
@ -1531,15 +1531,6 @@ JNIEXPORT jobjectArray JNICALL Java_com_zerotier_sdk_Node_peers(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int peerCount = peerList->peerCount * 100;
|
||||
LOGV("Ensure Local Capacity: %d", peerCount);
|
||||
if(env->EnsureLocalCapacity(peerCount))
|
||||
{
|
||||
LOGE("EnsureLocalCapacity failed!!");
|
||||
ZT_Node_freeQueryResult(node, peerList);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
jclass peerClass = lookup.findClass("com/zerotier/sdk/Peer");
|
||||
if(env->ExceptionCheck() || peerClass == NULL)
|
||||
{
|
||||
@ -1568,6 +1559,8 @@ JNIEXPORT jobjectArray JNICALL Java_com_zerotier_sdk_Node_peers(
|
||||
LOGE("Error assigning Peer object to array");
|
||||
break;
|
||||
}
|
||||
|
||||
env->DeleteLocalRef(peerObj);
|
||||
}
|
||||
|
||||
ZT_Node_freeQueryResult(node, peerList);
|
||||
@ -1624,6 +1617,8 @@ JNIEXPORT jobjectArray JNICALL Java_com_zerotier_sdk_Node_networks(
|
||||
LOGE("Error assigning VirtualNetworkConfig object to array");
|
||||
break;
|
||||
}
|
||||
|
||||
env->DeleteLocalRef(networkObject);
|
||||
}
|
||||
|
||||
ZT_Node_freeQueryResult(node, networkList);
|
||||
|
Loading…
x
Reference in New Issue
Block a user