From b6fe3f924aecac6d6e311673511ce61aa2f7a81f Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 12 Oct 2023 12:42:06 +1000 Subject: [PATCH] mi: fix CloseScreen initialization order If SHM is enabled it will set the CloseScreen pointer, only to be overridden by the hardcoded miCloseScreen pointer. Do this the other way round, miCloseScreen is the bottom of our stack. Direct leak of 48 byte(s) in 2 object(s) allocated from: #0 0x7f5ea3ad8cc7 in calloc (/lib64/libasan.so.8+0xd8cc7) (BuildId: d8f3addefe29e892d775c30eb364afd3c2484ca5)) #1 0x70adfb in ShmInitScreenPriv ../Xext/shm.c:213 Signed-off-by: Peter Hutterer Reviewed-by: Adam Jackson --- mi/miscrinit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mi/miscrinit.c b/mi/miscrinit.c index 264622d..907e46a 100644 --- a/mi/miscrinit.c +++ b/mi/miscrinit.c @@ -242,10 +242,10 @@ miScreenInit(ScreenPtr pScreen, void *pbits, /* pointer to screen bits */ pScreen->numVisuals = numVisuals; pScreen->visuals = visuals; if (width) { + pScreen->CloseScreen = miCloseScreen; #ifdef MITSHM ShmRegisterFbFuncs(pScreen); #endif - pScreen->CloseScreen = miCloseScreen; } /* else CloseScreen */ /* QueryBestSize, SaveScreen, GetImage, GetSpans */ -- 2.27.0