提交 eee56c49 编写于 作者: D dsamersoff

8162530: src/jdk.management/share/native/libmanagement_ext/GcInfoBuilder.c...

8162530: src/jdk.management/share/native/libmanagement_ext/GcInfoBuilder.c doesn't handle JNI exceptions properly
Summary: Exceptions are checked after calling NewStringUTF
Reviewed-by: dholmes, sla
Contributed-by: amit.sapre@oracle.com
上级 26d68f3e
/* /*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -87,9 +87,32 @@ JNIEXPORT void JNICALL Java_sun_management_GcInfoBuilder_fillGcAttributeInfo ...@@ -87,9 +87,32 @@ JNIEXPORT void JNICALL Java_sun_management_GcInfoBuilder_fillGcAttributeInfo
for (i = 0; i < num_attributes; i++) { for (i = 0; i < num_attributes; i++) {
nativeTypes[i] = ext_att_info[i].type; nativeTypes[i] = ext_att_info[i].type;
attName = (*env)->NewStringUTF(env, ext_att_info[i].name); attName = (*env)->NewStringUTF(env, ext_att_info[i].name);
desc = (*env)->NewStringUTF(env, ext_att_info[i].description); if ((*env)->ExceptionCheck(env)) {
free(ext_att_info);
free(nativeTypes);
return;
}
(*env)->SetObjectArrayElement(env, attributeNames, i, attName); (*env)->SetObjectArrayElement(env, attributeNames, i, attName);
if ((*env)->ExceptionCheck(env)) {
free(ext_att_info);
free(nativeTypes);
return;
}
desc = (*env)->NewStringUTF(env, ext_att_info[i].description);
if ((*env)->ExceptionCheck(env)) {
free(ext_att_info);
free(nativeTypes);
return;
}
(*env)->SetObjectArrayElement(env, descriptions, i, desc); (*env)->SetObjectArrayElement(env, descriptions, i, desc);
if ((*env)->ExceptionCheck(env)) {
free(ext_att_info);
free(nativeTypes);
return;
}
} }
(*env)->SetCharArrayRegion(env, types, 0, num_attributes, nativeTypes); (*env)->SetCharArrayRegion(env, types, 0, num_attributes, nativeTypes);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册