Code Review
/
vpp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
review
|
tree
raw
|
patch
| inline |
side by side
(parent:
20abdd9
)
newIntArray() may fail
87/287/2
author
Robert Varga
<nite@hq.sk>
Wed, 10 Feb 2016 15:00:16 +0000
(16:00 +0100)
committer
Robert Varga
<nite@hq.sk>
Wed, 10 Feb 2016 15:24:31 +0000
(16:24 +0100)
Allocation of the integer array may fail, guard against NPE.
Change-Id: I3e860153597638392c9b669a6ad586fd2e03a64d
Signed-off-by: Robert Varga <nite@hq.sk>
vpp-japi/japi/vppjni.c
patch
|
blob
|
history
diff --git
a/vpp-japi/japi/vppjni.c
b/vpp-japi/japi/vppjni.c
index
4501146
..
3c80ff9
100644
(file)
--- 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;
}