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

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

Commit messages:
 - JDK-8392567

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

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

Reply via email to