xserver: Branch 'master' - 3 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Sep 15 19:13:55 UTC 2021


 glamor/glamor_program.c       |    2 ++
 hw/xwayland/xwayland-input.c  |    2 +-
 hw/xwayland/xwayland-screen.c |    8 ++++----
 3 files changed, 7 insertions(+), 5 deletions(-)

New commits:
commit 2906ee5e4a722138cccb3265a615da7705a52589
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Tue Sep 14 16:32:45 2021 +0200

    glamor: Fix leak in glamor_build_program()
    
    Fix the possible leak of `vs_prog_string` and `fs_prog_string` in case
    of failure, as reported by covscan.
    
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>

diff --git a/glamor/glamor_program.c b/glamor/glamor_program.c
index bd5ee5e5b..c51577fc3 100644
--- a/glamor/glamor_program.c
+++ b/glamor/glamor_program.c
@@ -383,6 +383,8 @@ fail:
         glDeleteProgram(prog->prog);
         prog->prog = 0;
     }
+    free(vs_prog_string);
+    free(fs_prog_string);
     free(version_string);
     free(fs_vars);
     free(vs_vars);
commit c01ac52b296aa794476784a246f8e4117b6b6e06
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Tue Sep 14 16:22:17 2021 +0200

    xwayland: Fix memory allocation test
    
    Due to a typo in tablet_pad_group(), we would allocate a variable
    ("group") and test another one ("pad") for allocation success.
    
    Spotted by covscan.
    
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Fixes: commit 8475e63 - "xwayland: add tablet pad support"
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>

diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 26b3630c7..8482c89ae 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -2268,7 +2268,7 @@ tablet_pad_group(void *data,
     struct xwl_tablet_pad_group *group;
 
     group = calloc(1, sizeof *group);
-    if (pad == NULL) {
+    if (group == NULL) {
         ErrorF("%s ENOMEM\n", __func__);
         return;
     }
commit 138d4eba7b0afd2bb839a8cbedf7245e19841013
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Tue Sep 14 16:14:57 2021 +0200

    xwayland: Fix leak of xwl_screen on init
    
    On screen init, if any of the private type registration fails we would
    return FALSE without actually freeing the xwl_screen we just allocated.
    
    This is not a serious leak as failure at that point would lead to the
    premature termination of Xwayland at startup, but covscan complains and
    it's easy enough to fix.
    
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>

diff --git a/hw/xwayland/xwayland-screen.c b/hw/xwayland/xwayland-screen.c
index bb18e5c94..b39a3d2fd 100644
--- a/hw/xwayland/xwayland-screen.c
+++ b/hw/xwayland/xwayland-screen.c
@@ -549,10 +549,6 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
     Bool use_eglstreams = FALSE;
 #endif
 
-    xwl_screen = calloc(1, sizeof *xwl_screen);
-    if (xwl_screen == NULL)
-        return FALSE;
-
     if (!dixRegisterPrivateKey(&xwl_screen_private_key, PRIVATE_SCREEN, 0))
         return FALSE;
     if (!xwl_pixmap_init())
@@ -567,6 +563,10 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
                                sizeof(struct xwl_client)))
         return FALSE;
 
+    xwl_screen = calloc(1, sizeof *xwl_screen);
+    if (xwl_screen == NULL)
+        return FALSE;
+
     dixSetPrivate(&pScreen->devPrivates, &xwl_screen_private_key, xwl_screen);
     xwl_screen->screen = pScreen;
 


More information about the xorg-commit mailing list