Integrated: JDK-8257604: JNI_ArgumentPusherVaArg leaks valist
Thomas Stuefe
stuefe at openjdk.java.net
Thu Dec 3 07:53:55 UTC 2020
On Wed, 2 Dec 2020 15:02:30 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
> JNI_ArgumentPusherVaArg copies the given argument list pointer (va_copy) but never releases it. A call to va_end is missing.
>
> AFAICS this coding is old. Interestingly, in jdk8 I find this:
>
> 0: inline void set_ap(va_list rap) {
> 0: #ifdef va_copy
> 0: va_copy(_ap, rap);
> 0: #elif defined (__va_copy)
> 0: __va_copy(_ap, rap);
> 0: #else
> 0: _ap = rap;
> 0: #endif
> 0: }
>
> `_ap = rap` seems a strangely relaxed way of doing this. But I do not know the history behind that.
>
> I could not find any usage of the original arg pointer, so maybe the `va_copy()` is not even needed. The jdk8 coding seems to indicate that too. But since I was not 100% sure I kept the `va_copy()` and added a `va_end()`.
>
> I also made this private (removed the `protected`) since there are no child classes.
This pull request has now been integrated.
Changeset: ae1eb286
Author: Thomas Stuefe <stuefe at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/ae1eb286
Stats: 5 lines in 1 file changed: 4 ins; 1 del; 0 mod
8257604: JNI_ArgumentPusherVaArg leaks valist
Reviewed-by: dcubed, coleenp
-------------
PR: https://git.openjdk.java.net/jdk/pull/1565
More information about the hotspot-dev
mailing list