8283225: ClassLoader.c produces incorrect OutOfMemory Exception when length is 0 (aix)
Reviewed-by: stuefe, rriggs, dholmes
This commit is contained in:
parent
d83cee98b5
commit
cab4ff6454
@ -99,7 +99,12 @@ Java_java_lang_ClassLoader_defineClass1(JNIEnv *env,
|
||||
return 0;
|
||||
}
|
||||
|
||||
// On AIX malloc(0) returns NULL which looks like an out-of-memory condition; so adjust it to malloc(1)
|
||||
#ifdef _AIX
|
||||
body = (jbyte *)malloc(length == 0 ? 1 : length);
|
||||
#else
|
||||
body = (jbyte *)malloc(length);
|
||||
#endif
|
||||
|
||||
if (body == 0) {
|
||||
JNU_ThrowOutOfMemoryError(env, 0);
|
||||
@ -239,7 +244,13 @@ Java_java_lang_ClassLoader_defineClass0(JNIEnv *env,
|
||||
return 0;
|
||||
}
|
||||
|
||||
// On AIX malloc(0) returns NULL which looks like an out-of-memory condition; so adjust it to malloc(1)
|
||||
#ifdef _AIX
|
||||
body = (jbyte *)malloc(length == 0 ? 1 : length);
|
||||
#else
|
||||
body = (jbyte *)malloc(length);
|
||||
#endif
|
||||
|
||||
if (body == 0) {
|
||||
JNU_ThrowOutOfMemoryError(env, 0);
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user