xfree86: plug a memory leak in xf86LoadModules.
LoadModule() returns the only reference to a fresh piece of memory (a ModuleDescPtr). Sadly, xf86LoadModules dropped the return value on the floor leaking memory for each module it loaded. Signed-off-by: Peter Hutterer <peter@cs.unisa.edu.au>
This commit is contained in:
parent
6dc71f6b2c
commit
3abce3ea2b
|
@ -1922,6 +1922,7 @@ xf86LoadModules(char **list, pointer *optlist)
|
||||||
int i;
|
int i;
|
||||||
char *name;
|
char *name;
|
||||||
Bool failed = FALSE;
|
Bool failed = FALSE;
|
||||||
|
ModuleDescPtr desc;
|
||||||
|
|
||||||
if (!list)
|
if (!list)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1945,11 +1946,15 @@ xf86LoadModules(char **list, pointer *optlist)
|
||||||
else
|
else
|
||||||
opt = NULL;
|
opt = NULL;
|
||||||
|
|
||||||
if (!LoadModule(name, NULL, NULL, NULL, opt, NULL, &errmaj, &errmin)) {
|
desc = LoadModule(name, NULL, NULL, NULL, opt, NULL, &errmaj,
|
||||||
|
&errmin);
|
||||||
|
if (!desc) {
|
||||||
LoaderErrorMsg(NULL, name, errmaj, errmin);
|
LoaderErrorMsg(NULL, name, errmaj, errmin);
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
}
|
}
|
||||||
xfree(name);
|
xfree(name);
|
||||||
|
xfree(desc->name);
|
||||||
|
xfree(desc);
|
||||||
}
|
}
|
||||||
return !failed;
|
return !failed;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue