CDesktopPeer.m creates dispatch semaphores via dispatch_semaphore_create in 
both _lsOpenURI and _lsOpenFile but never releases them. Since the JDK is 
compiled without ARC, each call to Desktop.open(), browse(), mail(), edit(), or 
print() leaks around 80 bytes.

The issue is similar to 
[JDK-8376233](https://bugs.openjdk.org/browse/JDK-8376233)

The fix adds dispatch_release(semaphore) after dispatch_semaphore_wait in both 
functions, paired with dispatch_retain before the async block to prevent 
use-after-free on the timeout path.

-------------

Commit messages:
 - fix for timeout case
 - 8378727: [macOS] Missing dispatch_release for semaphores in CDesktopPeer

Changes: https://git.openjdk.org/jdk/pull/29927/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29927&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8378727
  Stats: 6 lines in 1 file changed: 6 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/29927.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29927/head:pull/29927

PR: https://git.openjdk.org/jdk/pull/29927

Reply via email to