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>
This commit is contained in:
Tiago Vignatti 2011-03-28 20:24:52 +03:00
parent 593ccaeaaf
commit 90955857b2

View file

@ -533,6 +533,7 @@ LoaderListDirs(const char **subdirlist, const char **patternlist)
FreePathList(pathlist);
FreeSubdirs(subdirs);
FreePatterns(patterns);
closedir(d);
return NULL;
}
listing[n] = malloc(len + 1);
@ -541,6 +542,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,
@ -557,6 +559,10 @@ LoaderListDirs(const char **subdirlist, const char **patternlist)
}
if (listing)
listing[n] = NULL;
FreePathList(pathlist);
FreeSubdirs(subdirs);
FreePatterns(patterns);
return listing;
}