RFR: JDK-8297688: libjli leaks memory related to options handling

Justin King jcking at openjdk.org
Mon Nov 28 03:30:33 UTC 2022


Fix memory leaks by making `AddOption` unconditionally duplicate passed in strings, taking ownership. Callers using dynamic memory free their storage after calling `AddOption`. This ensures no memory is dropped on the floor. This also removes the second argument to `AddOption` as it is unused and shifts it into the source file.

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

Commit messages:
 - Fix memory leaks related to options in libjli

Changes: https://git.openjdk.org/jdk/pull/11384/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11384&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8297688
  Stats: 55 lines in 2 files changed: 22 ins; 1 del; 32 mod
  Patch: https://git.openjdk.org/jdk/pull/11384.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11384/head:pull/11384

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


More information about the core-libs-dev mailing list