summaryrefslogtreecommitdiff
path: root/fs/squashfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/squashfs')
-rw-r--r--fs/squashfs/Makefile2
-rw-r--r--fs/squashfs/sqfs.c10
2 files changed, 7 insertions, 5 deletions
diff --git a/fs/squashfs/Makefile b/fs/squashfs/Makefile
index 0772e1a497d..c71c9d43d7a 100644
--- a/fs/squashfs/Makefile
+++ b/fs/squashfs/Makefile
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0+
#
-obj-$(CONFIG_$(XPL_)FS_SQUASHFS) = sqfs.o \
+obj-$(CONFIG_$(PHASE_)FS_SQUASHFS) = sqfs.o \
sqfs_inode.o \
sqfs_dir.o \
sqfs_decompressor.o
diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c
index 7c364686f14..2dcdd60f683 100644
--- a/fs/squashfs/sqfs.c
+++ b/fs/squashfs/sqfs.c
@@ -949,7 +949,7 @@ static int sqfs_opendir_nest(const char *filename, struct fs_dir_stream **dirsp)
goto out;
}
- token_list = malloc(token_count * sizeof(char *));
+ token_list = calloc(token_count, sizeof(char *));
if (!token_list) {
ret = -EINVAL;
goto out;
@@ -987,9 +987,11 @@ static int sqfs_opendir_nest(const char *filename, struct fs_dir_stream **dirsp)
*dirsp = (struct fs_dir_stream *)dirs;
out:
- for (j = 0; j < token_count; j++)
- free(token_list[j]);
- free(token_list);
+ if (token_list) {
+ for (j = 0; j < token_count; j++)
+ free(token_list[j]);
+ free(token_list);
+ }
free(pos_list);
free(path);
if (ret) {