Skip to content

Commit fceca5a

Browse files
committed
8292214: Memory leak in getAllConfigs of awt_GraphicsEnv.c:386
Backport-of: 1166a8abd2e5fba16b5cd29431de2628a52a8e08
1 parent 468b36a commit fceca5a

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ getAllConfigs (JNIEnv *env, int screen, AwtScreenDataPtr screenDataPtr) {
386386
*/
387387
screenDataPtr->defaultConfig = makeDefaultConfig(env, screen);
388388
if (screenDataPtr->defaultConfig == NULL) {
389-
return;
389+
goto cleanup;
390390
}
391391
}
392392

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

576576
cleanup:
577577
if (success != JNI_TRUE) {
578+
for (i = 0; i < nConfig; i++) {
579+
free(graphicsConfigs[i]);
580+
}
578581
free(graphicsConfigs);
579582
}
580583
if (n8p != 0)

0 commit comments

Comments
 (0)