Skip to content

Commit c73f05b

Browse files
author
Alexander Zuev
committed
8376233: Clean up code in Desktop native peer
Reviewed-by: aivanov, prr
1 parent 37dc1be commit c73f05b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/java.desktop/macosx/native/libawt_lwawt/awt/CDesktopPeer.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2026, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -120,6 +120,7 @@
120120
if (appURI == nil
121121
|| [[urlToOpen absoluteString] containsString:[appURI absoluteString]]
122122
|| [[defaultTerminalApp absoluteString] containsString:[appURI absoluteString]]) {
123+
[urlToOpen release];
123124
return -1;
124125
}
125126
// Additionally set forPrinting=TRUE for print
@@ -129,6 +130,7 @@
129130
} else if (action == sun_lwawt_macosx_CDesktopPeer_EDIT) {
130131
if (appURI == nil
131132
|| [[urlToOpen absoluteString] containsString:[appURI absoluteString]]) {
133+
[urlToOpen release];
132134
return -1;
133135
}
134136
// for EDIT: if (defaultApp = TerminalApp) then set appURI = DefaultTextEditor
@@ -156,6 +158,7 @@
156158

157159
dispatch_semaphore_wait(semaphore, timeout);
158160

161+
[urlToOpen release];
159162
JNI_COCOA_EXIT(env);
160163
return status;
161164
}

src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2026, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -92,6 +92,8 @@ JNIEXPORT jstring JNICALL Java_sun_awt_windows_WDesktopPeer_ShellExecute
9292
if (wcscmp(verb_c, L"open") == 0) {
9393
BOOL isExecutable = SaferiIsExecutableFileType(fileOrUri_c, FALSE);
9494
if (isExecutable) {
95+
JNU_ReleaseStringPlatformChars(env, fileOrUri_j, fileOrUri_c);
96+
JNU_ReleaseStringPlatformChars(env, verb_j, verb_c);
9597
return env->NewStringUTF("Unsupported URI content");
9698
}
9799
}

0 commit comments

Comments
 (0)