newIntArray() may fail
Allocation of the integer array may fail, guard against NPE.
Change-Id: I3e860153597638392c9b669a6ad586fd2e03a64d
Signed-off-by: Robert Varga <nite@hq.sk>
diff --git a/vpp-japi/japi/vppjni.c b/vpp-japi/japi/vppjni.c
index 4501146..3c80ff9 100644
--- a/vpp-japi/japi/vppjni.c
+++ b/vpp-japi/japi/vppjni.c
@@ -894,11 +894,14 @@
}
jintArray bdidArray = (*env)->NewIntArray(env, vec_len(buf));
+ if (!bdidArray) {
+ goto out;
+ }
(*env)->SetIntArrayRegion(env, bdidArray, 0, vec_len(buf), (int*)buf);
+out:
vec_free(buf);
-
return bdidArray;
}