]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
fs/squashfs: sqfs_concat_tokens: check if malloc succeeds
authorRichard Genoud <richard.genoud@posteo.net>
Tue, 3 Nov 2020 11:11:08 +0000 (12:11 +0100)
committerTom Rini <trini@konsulko.com>
Thu, 19 Nov 2020 14:45:49 +0000 (09:45 -0500)
memory allocation should always be checked

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
fs/squashfs/sqfs.c

index 72181f38332970dc7e62623ddcf98635e9670b86..7da2e09cc3653dd6a93a55d4237201e647140a3e 100644 (file)
@@ -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++) {