aboutsummaryrefslogtreecommitdiff
path: root/nx-X11
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2019-06-14 00:14:17 +0200
committerUlrich Sibiller <uli42@gmx.de>2019-06-19 00:49:33 +0200
commit0f8dbbab2a218269165f06de37db59b5a20f09ea (patch)
treee66562efc8da9965c0d27e9645cba9d98b408bf0 /nx-X11
parent308824ba96b8752835e15dedf2bc0e1cd7c1ddaa (diff)
downloadnx-libs-0f8dbbab2a218269165f06de37db59b5a20f09ea.tar.gz
nx-libs-0f8dbbab2a218269165f06de37db59b5a20f09ea.tar.bz2
nx-libs-0f8dbbab2a218269165f06de37db59b5a20f09ea.zip
Screen.c: correctly free stuff in nxagentCloseScreen
fixes a memory leak: ==19074== 2 bytes in 1 blocks are definitely lost in loss record 8 of 313 ==19074== at 0x483577F: malloc (vg_replace_malloc.c:299) ==19074== by 0x1FD83D: fbAllocatePrivates (fballpriv.c:79) ==19074== by 0x20A666: fbSetupScreen (fbscreen.c:110) ==19074== by 0x20A666: fbScreenInit (fbscreen.c:300) ==19074== by 0x1DEA4C: nxagentOpenScreen (Screen.c:1356) ==19074== by 0x16D7F8: AddScreen (dispatch.c:4257) ==19074== by 0x1DA0CF: InitOutput (Init.c:397) ==19074== by 0x14DCC2: main (main.c:280)
Diffstat (limited to 'nx-X11')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Screen.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
index 8568562c2..7d180da44 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
@@ -2141,20 +2141,32 @@ Bool nxagentCloseScreen(ScreenPtr pScreen)
fprintf(stderr, "running nxagentCloseScreen()\n");
#endif
+ /*
+ * We have called fbScreenInit() in nxagenOpenScreen, which in turn
+ * called fbOpenScreen. But we are not using the data as created by
+ * fbOpenScreen but have freed it and replaced by our own. So we free
+ * our own stuff here and take care that fbCloseScreen will not free
+ * them again.
+ */
+
for (i = 0; i < pScreen->numDepths; i++)
{
free(pScreen->allowedDepths[i].vids);
+ pScreen->allowedDepths[i].vids = NULL;
}
+ pScreen->numDepths = 0;
+
/*
* Free the frame buffer.
*/
free(((PixmapPtr)pScreen -> devPrivate) -> devPrivate.ptr);
+ free(pScreen->devPrivate);pScreen->devPrivate = NULL;
+ free(pScreen->allowedDepths); pScreen->allowedDepths = NULL;
+ free(pScreen->visuals); pScreen->visuals = NULL;
- free(pScreen->allowedDepths);
- free(pScreen->visuals);
- free(pScreen->devPrivate);
+ fbCloseScreen(pScreen);
/*
* Reset the geometry and alpha information