mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-11 10:58:26 +00:00
8211317: avoid memory leak in Java_sun_awt_UNIXToolkit_load_1stock_1icon
Reviewed-by: clanger, goetz
This commit is contained in:
parent
0caefc787f
commit
cd597d1dfd
@ -183,6 +183,7 @@ Java_sun_awt_UNIXToolkit_load_1stock_1icon(JNIEnv *env, jobject this,
|
||||
detail_str = (char *)SAFE_SIZE_ARRAY_ALLOC(malloc,
|
||||
sizeof(char), len + 1);
|
||||
if (detail_str == NULL) {
|
||||
free(stock_id_str);
|
||||
JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
|
||||
return JNI_FALSE;
|
||||
}
|
||||
@ -190,6 +191,10 @@ Java_sun_awt_UNIXToolkit_load_1stock_1icon(JNIEnv *env, jobject this,
|
||||
}
|
||||
|
||||
if (!init_method(env, this) ) {
|
||||
free(stock_id_str);
|
||||
if (detail_str != NULL) {
|
||||
free(detail_str);
|
||||
}
|
||||
return JNI_FALSE;
|
||||
}
|
||||
jboolean result = gtk->get_icon_data(env, widget_type, stock_id_str,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user