xserver: Branch 'master'

Peter Hutterer whot at kemper.freedesktop.org
Tue Feb 19 03:15:56 PST 2008


 hw/xfree86/common/xf86Init.c |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

New commits:
commit 67a78e84a81571cedaf7fd214a21ce1bbdc4fb3b
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Tue Feb 19 21:31:50 2008 +1030

    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.

diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 7bcfdff..41cf1d1 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);
     }


More information about the xorg-commit mailing list