Two independent issues:
fb overwrites CloseScreen unconditionally, leaving any work otherwise
performed by miCloseScreen hanging. That doesn't matter as much since all
that does is free the pixmap (which gets freed by fbDestroyPixmap anyway).

But, since miScreenInit also unconditionally inits the SHM privates and
overwrites CloseScreen, these privates are never cleaned up.

The correct fix will likely be something that calls both miCloseScreen and
then down into ShmCloseScreen.

==16606== 72 bytes in 3 blocks are definitely lost in loss record 34 of 57
==16606==    at 0x4A05BB4: calloc (vg_replace_malloc.c:467)
==16606==    by 0x4BB1B1: ShmInitScreenPriv (shm.c:225)
==16606==    by 0x4BB2BE: ShmRegisterFuncs (shm.c:257)
==16606==    by 0x4BB3B6: ShmRegisterFbFuncs (shm.c:285)
==16606==    by 0x5C6017: miScreenInit (miscrinit.c:243)
==16606==    by 0x48C114: fbFinishScreenInit (fbscreen.c:254)
==16606==    by 0x48C232: fbScreenInit (fbscreen.c:309)
==16606==    by 0x41C35F: vfbScreenInit (InitOutput.c:875)
==16606==    by 0x433FA6: AddScreen (dispatch.c:3909)
==16606==    by 0x41C62B: InitOutput (InitOutput.c:967)
==16606==    by 0x5ACB18: main (main.c:204)

Signed-off-by: Peter Hutterer <[email protected]>
---
 fb/fbscreen.c  |    3 ++-
 mi/miscrinit.c |    1 +
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fb/fbscreen.c b/fb/fbscreen.c
index 9e6ecf5..daed2f8 100644
--- a/fb/fbscreen.c
+++ b/fb/fbscreen.c
@@ -226,7 +226,8 @@ fbFinishScreenInit(ScreenPtr        pScreen,
                        rootdepth, ndepths, depths,
                        defaultVisual, nvisuals, visuals))
        return FALSE;
-    /* overwrite miCloseScreen with our own */
+    /* overwrite miCloseScreen with our own
+     * FIXME: leaking memory due to missing miCloseScreen cleanup */
     pScreen->CloseScreen = fbCloseScreen;
     if (bpp == 24 && imagebpp == 32)
     {
diff --git a/mi/miscrinit.c b/mi/miscrinit.c
index fb01c68..5e90fbe 100644
--- a/mi/miscrinit.c
+++ b/mi/miscrinit.c
@@ -242,6 +242,7 @@ miScreenInit(
 #ifdef MITSHM
        ShmRegisterFbFuncs(pScreen);
 #endif
+       /* FIXME: this overwrites shm CloseScreen, leaving a memleak */
        pScreen->CloseScreen = miCloseScreen;
     }
     /* else CloseScreen */
-- 
1.7.7.6

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to