8162524: src/jdk.management/share/native/libmanagement_ext/Flag.c doesn't handle JNI exceptions
authordsamersoff
Mon, 01 Aug 2016 13:53:55 +0300
changeset 40199 1795251e7dec
parent 40198 725b19ace748
child 40200 80c101dbb38d
child 40201 1b71d6ff5b2f
8162524: src/jdk.management/share/native/libmanagement_ext/Flag.c doesn't handle JNI exceptions Summary: add missed exception check Reviewed-by: dholmes, hb, dsamersoff Contributed-by: amit.sapre@oracle.com
jdk/src/jdk.management/share/native/libmanagement_ext/Flag.c
--- a/jdk/src/jdk.management/share/native/libmanagement_ext/Flag.c	Mon Aug 01 10:51:32 2016 +0300
+++ b/jdk/src/jdk.management/share/native/libmanagement_ext/Flag.c	Mon Aug 01 13:53:55 2016 +0300
@@ -141,6 +141,13 @@
             // ignore unsupported type
             continue;
         }
+
+        if (valueObj == NULL) {
+            free(globals);
+            JNU_ThrowOutOfMemoryError(env, 0);
+            return 0;
+        }
+
         switch (globals[i].origin) {
         case JMM_VMGLOBAL_ORIGIN_DEFAULT:
             origin = default_origin;