From 67a78e84a81571cedaf7fd214a21ce1bbdc4fb3b Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 19 Feb 2008 21:31:50 +1030 Subject: [PATCH] Revert "xfree86: plug a memory leak in xf86LoadModules." This reverts commit 3abce3ea2b1f43bd111664d4a57e5ccd282acab0 and 6cbaf15e6109ba77819c4070f5b46c78237ec460. The memory returned to xf86LoadModule was allocated in doLoadModule, which calls the respective module's PreInit. As it turns out, input and output drivers store a pointer to the module elswhere, so freeing it in xf86LoadModule is a bad idea. For further reference: hw/xfree86/common/xf86Helper.c Input drivers: xf86InputDriverList[blah]->module = module; Output drivers: xf86DriverList[blah]->module = module; Unloading the module would not look pretty then. --- hw/xfree86/common/xf86Init.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index 7bcfdff40..41cf1d17c 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -1922,7 +1922,6 @@ xf86LoadModules(char **list, pointer *optlist) int i; char *name; Bool failed = FALSE; - ModuleDescPtr desc; if (!list) return TRUE; @@ -1946,14 +1945,9 @@ xf86LoadModules(char **list, pointer *optlist) else opt = NULL; - desc = LoadModule(name, NULL, NULL, NULL, opt, NULL, &errmaj, - &errmin); - if (!desc) { + if (!LoadModule(name, NULL, NULL, NULL, opt, NULL, &errmaj, &errmin)) { LoaderErrorMsg(NULL, name, errmaj, errmin); failed = TRUE; - } else { - xfree(desc->name); - xfree(desc); } xfree(name); }