summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorRichard Genoud <richard.genoud@posteo.net>2020-11-03 12:11:08 +0100
committerTom Rini <trini@konsulko.com>2020-11-19 09:45:49 -0500
commitdc3312c43c82ff9335b2bf4ee4f72365e824adfd (patch)
treec3538fa5f1685c61261b5bed5a6794fc0159d254 /fs
parent4c83d2755776d4dd5e15a930d48db1082fc0d1cc (diff)
downloadu-boot-dc3312c43c82ff9335b2bf4ee4f72365e824adfd.tar.gz
u-boot-dc3312c43c82ff9335b2bf4ee4f72365e824adfd.tar.bz2
u-boot-dc3312c43c82ff9335b2bf4ee4f72365e824adfd.zip
fs/squashfs: sqfs_concat_tokens: check if malloc succeeds
memory allocation should always be checked Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com> Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
Diffstat (limited to 'fs')
-rw-r--r--fs/squashfs/sqfs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c
index 72181f3833..7da2e09cc3 100644
--- a/fs/squashfs/sqfs.c
+++ b/fs/squashfs/sqfs.c
@@ -242,6 +242,9 @@ static char *sqfs_concat_tokens(char **token_list, int token_count)
length = sqfs_get_tokens_length(token_list, token_count);
result = malloc(length + 1);
+ if (!result)
+ return NULL;
+
result[length] = '\0';
for (i = 0; i < token_count; i++) {