summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}