Message ID | 20201103111126.23600-11-richard.genoud@posteo.net |
---|---|
State | Accepted |
Commit | dc3312c43c82ff9335b2bf4ee4f72365e824adfd |
Delegated to: | Tom Rini |
Headers | show |
Series | fs/squashfs: fix memory leaks and introduce exists() function | expand |
Reviewed-by Joao Marcos Costa <jmcosta944@gmail.com> Em ter., 3 de nov. de 2020 às 08:12, Richard Genoud < richard.genoud@posteo.net> escreveu: > memory allocation should always be checked > > Signed-off-by: Richard Genoud <richard.genoud@posteo.net> > --- > 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++) { >
On Tue, Nov 03, 2020 at 12:11:08PM +0100, Richard Genoud wrote: > memory allocation should always be checked > > Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com> > Signed-off-by: Richard Genoud <richard.genoud@posteo.net> Applied to u-boot/master, thanks!
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++) {
memory allocation should always be checked Signed-off-by: Richard Genoud <richard.genoud@posteo.net> --- fs/squashfs/sqfs.c | 3 +++ 1 file changed, 3 insertions(+)