On Fri, 16 Oct 2026 08:55:58 GMT, Matthias Baesken <[email protected]> wrote:
> The gcc static analyzer reports this issue :
>
> `jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c:1195:1:
> warning: leak of 'asd.configs' [CWE-401] [-Wanalyzer-malloc-leak]`
>
> In Java_sun_awt_X11GraphicsConfig_init(JNIEnv *env, jobject this, jint
> visualNum, jint screen)
> we have this coding
>
>
> AwtScreenData asd = x11Screens[screen];
> ...
> if (asd.numConfigs == 0) {
> getAllConfigs(env, screen, &asd); // line 1163 — seems we fill the
> 'local copy' asd only
> }
>
>
> So at the end of function Java_sun_awt_X11GraphicsConfig_init, the leask of
> some asd field is reported.
> (maybe we do not call these init methods very often, so it might be a rare
> issue)
>
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK
> Interim AI Policy](https://openjdk.org/legal/ai).
This pull request has now been integrated.
Changeset: bd97c58d
Author: Matthias Baesken <[email protected]>
URL:
https://git.openjdk.org/jdk/commit/bd97c58dc37185801c16935eecb6cf065eb38d78
Stats: 10 lines in 1 file changed: 4 ins; 0 del; 6 mod
8392567: [GCC static analyzer] potential leak of asd in
Java_sun_awt_X11GraphicsConfig_init
Reviewed-by: prr, mdoerr
-------------
PR: https://git.openjdk.org/jdk/pull/33405