From 6f44d672aa34d343f63f0ea81ad58154a66b57ec Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 27 Feb 2012 17:17:41 +1000 Subject: xkb: free XkbRulesUsed and XkbRulesDflt on extension cleanup ==2547== 1 bytes in 1 blocks are still reachable in loss record 1 of 111 ==2547== at 0x4C2A4CD: malloc (vg_replace_malloc.c:236) ==2547== by 0x64D1551: strdup (strdup.c:43) ==2547== by 0x4802FB: Xstrdup (utils.c:1113) ==2547== by 0x585B6C: XkbSetRulesUsed (xkbInit.c:219) ==2547== by 0x58700F: InitKeyboardDeviceStruct (xkbInit.c:595) ==2547== by 0x419FA3: vfbKeybdProc (InitInput.c:74) ==2547== by 0x425A3D: ActivateDevice (devices.c:540) ==2547== by 0x425F65: InitAndStartDevices (devices.c:713) ==2547== by 0x5ACA57: main (main.c:259) and a few more of the above. Signed-off-by: Peter Hutterer Reviewed-by: Keith Packard --- dix/devices.c | 1 + include/xkbsrv.h | 3 +++ xkb/xkbInit.c | 15 +++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/dix/devices.c b/dix/devices.c index fa94a9438..0c718d204 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -1052,6 +1052,7 @@ CloseDownDevices(void) inputInfo.pointer = NULL; XkbDeleteRulesDflts(); + XkbDeleteRulesUsed(); OsReleaseSignals(); } diff --git a/include/xkbsrv.h b/include/xkbsrv.h index 45e2e8c47..346ebccf0 100644 --- a/include/xkbsrv.h +++ b/include/xkbsrv.h @@ -751,6 +751,9 @@ extern _X_EXPORT void XkbSetRulesDflts(XkbRMLVOSet * /* rmlvo */ extern _X_EXPORT void XkbDeleteRulesDflts(void ); +extern _X_EXPORT void XkbDeleteRulesUsed(void + ); + extern _X_EXPORT int SProcXkbDispatch(ClientPtr /* client */ ); diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index 4e8e267da..244c353c6 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -250,6 +250,21 @@ XkbSetRulesDflts(XkbRMLVOSet * rmlvo) return; } +void +XkbDeleteRulesUsed(void) +{ + free(XkbRulesUsed); + XkbRulesUsed = NULL; + free(XkbModelUsed); + XkbModelUsed = NULL; + free(XkbLayoutUsed); + XkbLayoutUsed = NULL; + free(XkbVariantUsed); + XkbVariantUsed = NULL; + free(XkbOptionsUsed); + XkbOptionsUsed = NULL; +} + void XkbDeleteRulesDflts(void) { -- cgit v1.2.3