diff options
author | Richard Genoud <richard.genoud@posteo.net> | 2020-11-24 20:07:52 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-12-03 00:21:58 +0300 |
commit | 7e932ac790b3615a67a3c24041c194aa748c0d98 (patch) | |
tree | b19f4be0f32a13d02338a078a1c70e6004248e1c /fs/squashfs/sqfs.c | |
parent | ab31883ae7e54ded8396b13a9057f861bf916ea4 (diff) | |
download | u-boot-7e932ac790b3615a67a3c24041c194aa748c0d98.tar.xz |
fs/squashfs: sqfs_close/sqfs_read_sblk: set ctxt.sblk to NULL after free
This will prevent a double free error if sqfs_close() is called twice.
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
Diffstat (limited to 'fs/squashfs/sqfs.c')
-rw-r--r-- | fs/squashfs/sqfs.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 608a2bb454..5de69ac3ca 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/squashfs/sqfs.c @@ -49,6 +49,7 @@ static int sqfs_read_sblk(struct squashfs_super_block **sblk) if (sqfs_disk_read(0, 1, *sblk) != 1) { free(*sblk); + sblk = NULL; return -EINVAL; } @@ -1689,9 +1690,10 @@ free_strings: void sqfs_close(void) { + sqfs_decompressor_cleanup(&ctxt); free(ctxt.sblk); + ctxt.sblk = NULL; ctxt.cur_dev = NULL; - sqfs_decompressor_cleanup(&ctxt); } void sqfs_closedir(struct fs_dir_stream *dirs) |