From 7564422263a10ec8992e538bb741b2ddb51dad82 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 17 Jun 2019 23:37:51 +0200 Subject: 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(-) (limited to 'nx-X11') 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 -- cgit v1.2.3