[X2Go-Commits] [nx-libs] 81/219: Screen.c: fix another memory leak

git-admin at x2go.org git-admin at x2go.org
Sat Sep 28 12:10:26 CEST 2019


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch 3.6.x
in repository nx-libs.

commit 7564422263a10ec8992e538bb741b2ddb51dad82
Author: Ulrich Sibiller <uli42 at gmx.de>
Date:   Mon Jun 17 23:37:51 2019 +0200

    Screen.c: fix another memory leak
    
    ==12280== 0 bytes in 5 blocks are definitely lost in loss record 1 of 304
    ==12280==    at 0x483577F: malloc (vg_replace_malloc.c:299)
    ==12280==    by 0x2EFC29: init_visuals (xf86glx.c:489)
    ==12280==    by 0x2EFC29: __MESA_initVisuals (xf86glx.c:540)
    ==12280==    by 0x17C902: GlxInitVisuals (glxext.c:317)
    ==12280==    by 0x218C03: fbInitVisuals (fbcmap.c:668)
    ==12280==    by 0x20BC41: fbFinishScreenInit (fbscreen.c:229)
    ==12280==    by 0x20C005: fbScreenInit (fbscreen.c:273)
    ==12280==    by 0x1E024C: nxagentOpenScreen (Screen.c:1356)
    ==12280==    by 0x16D828: AddScreen (dispatch.c:4171)
    ==12280==    by 0x1DB7DF: InitOutput (Init.c:396)
    ==12280==    by 0x14DB12: main (main.c:279)
    ==12280==
    ==12280== 64 bytes in 2 blocks are definitely lost in loss record 223 of 304
    ==12280==    at 0x483577F: malloc (vg_replace_malloc.c:299)
    ==12280==    by 0x2EFA05: init_visuals (xf86glx.c:489)
    ==12280==    by 0x2EFA05: __MESA_initVisuals (xf86glx.c:540)
    ==12280==    by 0x17C902: GlxInitVisuals (glxext.c:317)
    ==12280==    by 0x218C03: fbInitVisuals (fbcmap.c:668)
    ==12280==    by 0x20BC41: fbFinishScreenInit (fbscreen.c:229)
    ==12280==    by 0x20C005: fbScreenInit (fbscreen.c:273)
    ==12280==    by 0x1E024C: nxagentOpenScreen (Screen.c:1356)
    ==12280==    by 0x16D828: AddScreen (dispatch.c:4171)
    ==12280==    by 0x1DB7DF: InitOutput (Init.c:396)
    ==12280==    by 0x14DB12: main (main.c:279)
---
 nx-X11/programs/Xserver/hw/nxagent/Screen.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
index 84ef9c4a4..2fcb741db 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
@@ -1391,15 +1391,23 @@ Bool nxagentOpenScreen(ScreenPtr pScreen,
      * by fbScreenInit with our own.
      */
 
-    free(pScreen -> visuals);
+    for (int i = 0; i < pScreen->numDepths; i++)
+    {
+      #ifdef DEBUG
+      fprintf(stderr, "%s: depth [%d] index [%d] vids [%p]\n", __func__, pScreen->allowedDepths[i].depth, i, (void*) pScreen->allowedDepths[i].vids);
+      #endif
+      free(pScreen->allowedDepths[i].vids);
+    }
+
     free(pScreen -> allowedDepths);
+    pScreen -> allowedDepths = depths;
+    pScreen -> numDepths = numDepths;
+    pScreen -> rootDepth = rootDepth;
 
+    free(pScreen -> visuals);
     pScreen -> visuals = visuals;
-    pScreen -> allowedDepths = depths;
     pScreen -> numVisuals = numVisuals;
-    pScreen -> numDepths = numDepths;
     pScreen -> rootVisual = defaultVisual;
-    pScreen -> rootDepth = rootDepth;
 
     /*
      * Set up the internal structures used for

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git


More information about the x2go-commits mailing list