dix: reset the registry before quitting

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@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Peter Hutterer 2012-02-27 18:59:45 +10:00
parent 6f44d672aa
commit d3d4af5f9e
3 changed files with 20 additions and 8 deletions

View File

@ -358,6 +358,8 @@ main(int argc, char *argv[], char *envp[])
dixFreePrivates(serverClient->devPrivates, PRIVATE_CLIENT);
serverClient->devPrivates = NULL;
dixFreeRegistry();
FreeFonts();
FreeAllAtoms();

View File

@ -280,14 +280,9 @@ LookupResourceName(RESTYPE resource)
return resources[resource] ? resources[resource] : XREGISTRY_UNKNOWN;
}
/*
* Setup and teardown
*/
void
dixResetRegistry(void)
dixFreeRegistry(void)
{
ExtensionEntry extEntry = { .name = CORE };
/* Free all memory */
while (nmajor--) {
while (nminor[nmajor])
@ -315,9 +310,23 @@ dixResetRegistry(void)
nmajor = nevent = nerror = nresource = 0;
if (fh) {
fclose(fh);
fh = NULL;
}
}
/*
* Setup and teardown
*/
void
dixResetRegistry(void)
{
ExtensionEntry extEntry = { .name = CORE };
dixFreeRegistry();
/* Open the protocol file */
if (fh)
fclose(fh);
fh = fopen(FILENAME, "r");
if (!fh)
LogMessage(X_WARNING,

View File

@ -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 */