summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorTiago Vignatti <tiago.vignatti@nokia.com>2011-03-28 20:24:52 +0300
committerTiago Vignatti <tiago.vignatti@nokia.com>2011-04-04 17:36:37 +0300
commit3d59f005cfc83f81f2847d94108f66f824cd926b (patch)
tree926c03f02b0c5e898481be8630422b8017559cf2 /hw
parent77fcfd0e94c200ee383cf9d03383cde947eef6fd (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>
Diffstat (limited to 'hw')
-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;
}