On Mon, 28 Nov 2022 03:23:01 GMT, Justin King <jck...@openjdk.org> wrote:

> 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.

We can always add two separate functions or a separate parameter signifying 
ownership semantics. Then deal with it appropriately by maintaining a separate 
list of owned strings. Up to core-libs. I just went for the path of least 
complexity to start with.

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

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

Reply via email to