mksquashfs: fix "new" variable leak in dir_scan1()
Fix leak in dir_scan1() where new returned by excluded() was
not freed. Normally new will be null unless exclude files and
wildcards have been used.
Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c
index 43b07b7..7822c66 100644
--- a/squashfs-tools/mksquashfs.c
+++ b/squashfs-tools/mksquashfs.c
@@ -3735,6 +3735,7 @@
free_dir_entry(dir_ent);
free(filename);
free(subpath);
+ free(new);
continue;
}
@@ -3743,6 +3744,7 @@
sub_dir = NULL;
add_dir_entry(dir_ent, sub_dir, lookup_inode(&buf));
+ free(new);
}
scan1_freedir(dir);
@@ -4682,12 +4684,6 @@
}
-void free_subdir(struct pathnames *paths)
-{
- free(paths);
-}
-
-
int excluded(struct pathnames *paths, char *name, struct pathnames **new)
{
int i, n, res;
@@ -4740,7 +4736,7 @@
return FALSE;
empty_set:
- free_subdir(*new);
+ free(*new);
*new = NULL;
return res;
}