summaryrefslogtreecommitdiff
path: root/hw/xfree86
diff options
context:
space:
mode:
authorTiago Vignatti <tiago.vignatti@nokia.com>2011-03-31 16:26:06 +0300
committerPeter Hutterer <peter.hutterer@who-t.net>2011-04-04 09:55:05 +1000
commitd044d3675635f037bf0eb30e47f82460f78227d1 (patch)
tree769ad4df126a62259fe01e8049b37e9d73914df6 /hw/xfree86
parent9c4aae2141161e4bf69313a771db91c0acc4cc83 (diff)
xfree86: loader: fix memory leaks in LoaderListDirs
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Nicolas Peninguy <nico@lostgeeks.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'hw/xfree86')
-rw-r--r--hw/xfree86/loader/loadmod.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index eaa99e8c4..46ce68b86 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/hw/xfree86/loader/loadmod.c
@@ -532,6 +532,7 @@ LoaderListDirs(const char **subdirlist, const char **patternlist)
FreePathList(pathlist);
FreeSubdirs(subdirs);
FreePatterns(patterns);
+ closedir(d);
return NULL;
}
listing[n] = malloc(len + 1);
@@ -540,6 +541,7 @@ LoaderListDirs(const char **subdirlist, const char **patternlist)
FreePathList(pathlist);
FreeSubdirs(subdirs);
FreePatterns(patterns);
+ closedir(d);
return NULL;
}
strncpy(listing[n], dp->d_name + match[1].rm_so,
@@ -556,6 +558,10 @@ LoaderListDirs(const char **subdirlist, const char **patternlist)
}
if (listing)
listing[n] = NULL;
+
+ FreePathList(pathlist);
+ FreeSubdirs(subdirs);
+ FreePatterns(patterns);
return listing;
}