summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPaulo Zanoni <paulo.r.zanoni@intel.com>2011-10-31 17:54:03 -0200
committerPaulo Zanoni <paulo.r.zanoni@intel.com>2011-11-24 17:47:37 -0200
commitd5c7338b3eaea55177ade6fcba71a47ccd5547f5 (patch)
tree2555785ea5d53eef41b8cecdeba5f1fee08e2308 /hw
parent3d635fe84d6de53e2f74203b10e89f7851fe3fc1 (diff)
parser: free scandir's list
v2: move the free()s to the function that calls scandir 80 bytes in 1 blocks are definitely lost in loss record 411 of 631 at 0x4C2779D: malloc (vgpreload_memcheck-amd64-linux.so) by 0x4C27927: realloc (vgpreload_memcheck-amd64-linux.so) by 0x696A80D: scandir (scandir.c:108) by 0x4D8828: OpenConfigDir (scan.c:854) by 0x4D8A43: xf86openConfigDirFiles (scan.c:952) by 0x49031F: xf86HandleConfigFile (xf86Config.c:2327) by 0x49A9E3: InitOutput (xf86Init.c:365) by 0x425A7A: main (main.c:204) Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'hw')
-rw-r--r--hw/xfree86/parser/scan.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index d22d6ab74..9099227bb 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -800,14 +800,12 @@ AddConfigDirFiles(const char *dirpath, struct dirent **list, int num)
"files opened\n");
warnOnce = TRUE;
}
- free(list[i]);
continue;
}
path = malloc(PATH_MAX + 1);
snprintf(path, PATH_MAX + 1, "%s/%s", dirpath,
list[i]->d_name);
- free(list[i]);
file = fopen(path, "r");
if (!file) {
free(path);
@@ -858,8 +856,10 @@ OpenConfigDir(const char *path, const char *cmdline, const char *projroot,
if (!found) {
free(dirpath);
dirpath = NULL;
- free(list);
}
+ while (num--)
+ free(list[num]);
+ free(list);
}
free(pathcopy);