mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8230395: Code checks for NULL value returned from NEW_C_HEAP_ARRAY which can not happen
Reviewed-by: lkorinth, hseigel, thartmann, dnsimon
This commit is contained in:
parent
0e264cfe36
commit
23ec926327
16 changed files with 80 additions and 176 deletions
|
@ -669,7 +669,7 @@ static jclass Unsafe_DefineClass_impl(JNIEnv *env, jstring name, jbyteArray data
|
|||
ClassLoader::unsafe_defineClassCallCounter()->inc();
|
||||
}
|
||||
|
||||
body = NEW_C_HEAP_ARRAY(jbyte, length, mtInternal);
|
||||
body = NEW_C_HEAP_ARRAY_RETURN_NULL(jbyte, length, mtInternal);
|
||||
if (body == NULL) {
|
||||
throw_new(env, "java/lang/OutOfMemoryError");
|
||||
return 0;
|
||||
|
@ -685,7 +685,7 @@ static jclass Unsafe_DefineClass_impl(JNIEnv *env, jstring name, jbyteArray data
|
|||
int unicode_len = env->GetStringLength(name);
|
||||
|
||||
if (len >= sizeof(buf)) {
|
||||
utfName = NEW_C_HEAP_ARRAY(char, len + 1, mtInternal);
|
||||
utfName = NEW_C_HEAP_ARRAY_RETURN_NULL(char, len + 1, mtInternal);
|
||||
if (utfName == NULL) {
|
||||
throw_new(env, "java/lang/OutOfMemoryError");
|
||||
goto free_body;
|
||||
|
@ -790,7 +790,7 @@ Unsafe_DefineAnonymousClass_impl(JNIEnv *env,
|
|||
|
||||
int class_bytes_length = (int) length;
|
||||
|
||||
u1* class_bytes = NEW_C_HEAP_ARRAY(u1, length, mtInternal);
|
||||
u1* class_bytes = NEW_C_HEAP_ARRAY_RETURN_NULL(u1, length, mtInternal);
|
||||
if (class_bytes == NULL) {
|
||||
THROW_0(vmSymbols::java_lang_OutOfMemoryError());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue