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
--- 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;