aboutsummaryrefslogtreecommitdiffstats
path: root/vpp-japi
diff options
context:
space:
mode:
authorRobert Varga <nite@hq.sk>2016-02-10 16:00:16 +0100
committerRobert Varga <nite@hq.sk>2016-02-10 16:24:31 +0100
commitec3034c2ba034b675bb7332d91d00a1c4860c6b2 (patch)
treea3ce052d8511748a601bba3122e4731a9490c091 /vpp-japi
parent20abdd9b02595aec1d64574e59b24998dd51c31c (diff)
newIntArray() may fail
Allocation of the integer array may fail, guard against NPE. Change-Id: I3e860153597638392c9b669a6ad586fd2e03a64d Signed-off-by: Robert Varga <nite@hq.sk>
Diffstat (limited to 'vpp-japi')
-rw-r--r--vpp-japi/japi/vppjni.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/vpp-japi/japi/vppjni.c b/vpp-japi/japi/vppjni.c
index 45011467ebd..3c80ff9240c 100644
--- a/vpp-japi/japi/vppjni.c
+++ b/vpp-japi/japi/vppjni.c
@@ -894,11 +894,14 @@ static jintArray create_array_of_bd_ids(JNIEnv * env, jint bd_id)
}
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;
}