Skip to content

Commit 1166a8a

Browse files
Alisen ChungAlexander Zvegintsev
Alisen Chung
authored and
Alexander Zvegintsev
committedOct 4, 2022
8292214: Memory leak in getAllConfigs of awt_GraphicsEnv.c:386
Reviewed-by: azvegint, dnguyen
1 parent 3644e26 commit 1166a8a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ getAllConfigs (JNIEnv *env, int screen, AwtScreenDataPtr screenDataPtr) {
383383
*/
384384
screenDataPtr->defaultConfig = makeDefaultConfig(env, screen);
385385
if (screenDataPtr->defaultConfig == NULL) {
386-
return;
386+
goto cleanup;
387387
}
388388
}
389389

@@ -572,6 +572,9 @@ getAllConfigs (JNIEnv *env, int screen, AwtScreenDataPtr screenDataPtr) {
572572

573573
cleanup:
574574
if (success != JNI_TRUE) {
575+
for (i = 0; i < nConfig; i++) {
576+
free(graphicsConfigs[i]);
577+
}
575578
free(graphicsConfigs);
576579
}
577580
if (n8p != 0)

0 commit comments

Comments
 (0)
Please sign in to comment.