[PATCH] Xi: free barrier code at reset time

Peter Hutterer peter.hutterer at who-t.net
Tue Apr 23 21:59:11 PDT 2013


==29423== 16 bytes in 1 blocks are definitely lost in loss record 73 of 328
==29423==    at 0x4A06B6F: calloc (vg_replace_malloc.c:593)
==29423==    by 0x5987C0: XIBarrierInit (xibarriers.c:908)
==29423==    by 0x58F370: XInputExtensionInit (extinit.c:1300)
==29423==    by 0x4F33C3: InitExtensions (miinitext.c:337)
==29423==    by 0x4997DB: main (main.c:208)

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 Xi/extinit.c    |  2 ++
 Xi/xibarriers.c | 12 ++++++++++++
 Xi/xibarriers.h |  4 ++--
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/Xi/extinit.c b/Xi/extinit.c
index 619d0e4..13f22e0 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -1171,6 +1171,8 @@ IResetProc(ExtensionEntry * unused)
 
     free(xi_all_devices.name);
     free(xi_all_master_devices.name);
+
+    XIBarrierReset();
 }
 
 /***********************************************************************
diff --git a/Xi/xibarriers.c b/Xi/xibarriers.c
index fccab86..6732ce9 100644
--- a/Xi/xibarriers.c
+++ b/Xi/xibarriers.c
@@ -917,3 +917,15 @@ XIBarrierInit(void)
 
     return PointerBarrierType;
 }
+
+void
+XIBarrierReset(void)
+{
+    int i;
+    for (i = 0; i < screenInfo.numScreens; i++) {
+        ScreenPtr pScreen = screenInfo.screens[i];
+        BarrierScreenPtr cs = GetBarrierScreen(pScreen);
+        free(cs);
+        SetBarrierScreen(pScreen, NULL);
+    }
+}
diff --git a/Xi/xibarriers.h b/Xi/xibarriers.h
index 11e84ec..f61b482 100644
--- a/Xi/xibarriers.h
+++ b/Xi/xibarriers.h
@@ -36,8 +36,8 @@ int
 XIDestroyPointerBarrier(ClientPtr client,
                         xXFixesDestroyPointerBarrierReq * stuff);
 
-Bool
-XIBarrierInit(void);
+Bool XIBarrierInit(void);
+void XIBarrierReset(void);
 
 int SProcXIBarrierReleasePointer(ClientPtr client);
 int ProcXIBarrierReleasePointer(ClientPtr client);
-- 
1.8.1.4



More information about the xorg-devel mailing list