diff options
author | Arjan van de Ven <arjan@infradead.org> | 2008-02-18 18:13:10 +1030 |
---|---|---|
committer | Peter Hutterer <peter@cs.unisa.edu.au> | 2008-02-18 18:14:40 +1030 |
commit | 3abce3ea2b1f43bd111664d4a57e5ccd282acab0 (patch) | |
tree | 7e8427b6c8ee2987243ada71b64089badd44ce21 /hw/xfree86/common/xf86Init.c | |
parent | 6dc71f6b2c7ff49adb504426b4cd206e4745e1e3 (diff) |
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>
Diffstat (limited to 'hw/xfree86/common/xf86Init.c')
-rw-r--r-- | hw/xfree86/common/xf86Init.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index 41cf1d17c..0d90b9d43 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -1922,6 +1922,7 @@ xf86LoadModules(char **list, pointer *optlist) int i; char *name; Bool failed = FALSE; + ModuleDescPtr desc; if (!list) return TRUE; @@ -1945,11 +1946,15 @@ xf86LoadModules(char **list, pointer *optlist) else 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); failed = TRUE; } xfree(name); + xfree(desc->name); + xfree(desc); } return !failed; } |