diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2017-10-24 15:41:23 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2017-11-22 23:09:51 +0100 |
commit | 0acaaa4065c8cfd919fed46cf703146b9ed7b07a (patch) | |
tree | b8b9e53587e9e9ea44610bc9d3aadaf5a667e9ca /platform/java/mupdf_native.c | |
parent | ca154ac967599ba72d5d9dd98ae68db5d21d99c5 (diff) | |
download | mupdf-0acaaa4065c8cfd919fed46cf703146b9ed7b07a.tar.xz |
jni: Prevent memory leak by freeing upon error.
Previously the counts and points arrays would leak if
GetFloatArrayRegion() threw an exception.
Diffstat (limited to 'platform/java/mupdf_native.c')
-rw-r--r-- | platform/java/mupdf_native.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/platform/java/mupdf_native.c b/platform/java/mupdf_native.c index 561ba1dc..ccc50fad 100644 --- a/platform/java/mupdf_native.c +++ b/platform/java/mupdf_native.c @@ -8547,7 +8547,12 @@ FUN(PDFAnnotation_setInkList)(JNIEnv *env, jobject self, jobject jinklist) counts[i] = (*env)->GetArrayLength(env, jpath) / 2; (*env)->GetFloatArrayRegion(env, jpath, k, counts[i], points); - if ((*env)->ExceptionCheck(env)) return; + if ((*env)->ExceptionCheck(env)) + { + fz_free(ctx, counts); + fz_free(ctx, points); + return; + } (*env)->DeleteLocalRef(env, jpath); } |