From: Richard Genoud Date: Tue, 3 Nov 2020 11:11:09 +0000 (+0100) Subject: fs/squashfs: sqfs_size: fix dangling pointer dirs->entry X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=508a9dc7f694df11c7de7460f888f508e40a2046;p=u-boot.git fs/squashfs: sqfs_size: fix dangling pointer dirs->entry dirs->entry shouldn't be left dangling as it could be freed twice. Signed-off-by: Richard Genoud --- diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 7da2e09cc3..3b008b5235 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/squashfs/sqfs.c @@ -1569,6 +1569,7 @@ int sqfs_size(const char *filename, loff_t *size) if (!ret) break; free(dirs->entry); + dirs->entry = NULL; } if (ret) { @@ -1582,6 +1583,7 @@ int sqfs_size(const char *filename, loff_t *size) ipos = sqfs_find_inode(dirs->inode_table, i_number, sblk->inodes, sblk->block_size); free(dirs->entry); + dirs->entry = NULL; base = (struct squashfs_base_inode *)ipos; switch (get_unaligned_le16(&base->inode_type)) {