[PATCH 8/9] dix: reset the registry before quitting
Peter Hutterer
peter.hutterer at who-t.net
Mon Feb 27 16:41:05 PST 2012
Heaps of these:
==2042== 15,360 bytes in 120 blocks are still reachable in loss record 94 of
97
==2042== at 0x4C2A4CD: malloc (vg_replace_malloc.c:236)
==2042== by 0x4C2A657: realloc (vg_replace_malloc.c:525)
==2042== by 0x45FB91: double_size (registry.c:65)
==2042== by 0x45FC97: RegisterRequestName (registry.c:85)
==2042== by 0x460095: RegisterExtensionNames (registry.c:179)
==2042== by 0x460729: dixResetRegistry (registry.c:334)
==2042== by 0x5AC992: main (main.c:201)
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
dix/main.c | 2 ++
dix/registry.c | 24 +++++++++++++++++-------
include/registry.h | 1 +
3 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/dix/main.c b/dix/main.c
index 8e6df46..390e9dc 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -334,6 +334,8 @@ int main(int argc, char *argv[], char *envp[])
dixFreePrivates(serverClient->devPrivates, PRIVATE_CLIENT);
serverClient->devPrivates = NULL;
+ dixFreeRegistry();
+
FreeFonts();
FreeAllAtoms();
diff --git a/dix/registry.c b/dix/registry.c
index 5ab25ad..7b80a38 100644
--- a/dix/registry.c
+++ b/dix/registry.c
@@ -274,14 +274,9 @@ LookupResourceName(RESTYPE resource)
return resources[resource] ? resources[resource] : XREGISTRY_UNKNOWN;
}
-/*
- * Setup and teardown
- */
void
-dixResetRegistry(void)
+dixFreeRegistry(void)
{
- ExtensionEntry extEntry;
-
/* Free all memory */
while (nmajor--) {
while (nminor[nmajor])
@@ -309,9 +304,24 @@ dixResetRegistry(void)
nmajor = nevent = nerror = nresource = 0;
- /* Open the protocol file */
if (fh)
+ {
fclose(fh);
+ fh = NULL;
+ }
+}
+
+/*
+ * Setup and teardown
+ */
+void
+dixResetRegistry(void)
+{
+ ExtensionEntry extEntry;
+
+ dixFreeRegistry();
+
+ /* Open the protocol file */
fh = fopen(FILENAME, "r");
if (!fh)
LogMessage(X_WARNING, "Failed to open protocol names file " FILENAME "\n");
diff --git a/include/registry.h b/include/registry.h
index 44f7925..0210c78 100644
--- a/include/registry.h
+++ b/include/registry.h
@@ -44,6 +44,7 @@ extern _X_EXPORT const char *LookupResourceName(RESTYPE rtype);
* Setup and teardown
*/
extern _X_EXPORT void dixResetRegistry(void);
+extern _X_EXPORT void dixFreeRegistry(void);
#else /* XREGISTRY */
--
1.7.7.6
More information about the xorg-devel
mailing list