aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Genoud2020-11-03 12:11:08 +0100
committerTom Rini2020-11-19 09:45:49 -0500
commitdc3312c43c82ff9335b2bf4ee4f72365e824adfd (patch)
treec3538fa5f1685c61261b5bed5a6794fc0159d254
parent4c83d2755776d4dd5e15a930d48db1082fc0d1cc (diff)
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>
-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 72181f38332..7da2e09cc36 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++) {