newIntArray() may fail
Allocation of the integer array may fail, guard against NPE. Change-Id: I3e860153597638392c9b669a6ad586fd2e03a64d Signed-off-by: Robert Varga <nite@hq.sk>
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user