From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Genoud Date: Tue, 3 Nov 2020 12:11:08 +0100 Subject: [PATCH v2 10/28] fs/squashfs: sqfs_concat_tokens: check if malloc succeeds In-Reply-To: <20201103111126.23600-1-richard.genoud@posteo.net> References: <20201103111126.23600-1-richard.genoud@posteo.net> Message-ID: <20201103111126.23600-11-richard.genoud@posteo.net> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de memory allocation should always be checked Signed-off-by: Richard Genoud --- fs/squashfs/sqfs.c | 3 +++ 1 file changed, 3 insertions(+) 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++) {