mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-06-09 23:36:03 +09:00
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>
This commit is contained in:
parent
ab31883ae7
commit
7e932ac790
|
@ -49,6 +49,7 @@ static int sqfs_read_sblk(struct squashfs_super_block **sblk)
|
||||||
|
|
||||||
if (sqfs_disk_read(0, 1, *sblk) != 1) {
|
if (sqfs_disk_read(0, 1, *sblk) != 1) {
|
||||||
free(*sblk);
|
free(*sblk);
|
||||||
|
sblk = NULL;
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1689,9 +1690,10 @@ free_strings:
|
||||||
|
|
||||||
void sqfs_close(void)
|
void sqfs_close(void)
|
||||||
{
|
{
|
||||||
free(ctxt.sblk);
|
|
||||||
ctxt.cur_dev = NULL;
|
|
||||||
sqfs_decompressor_cleanup(&ctxt);
|
sqfs_decompressor_cleanup(&ctxt);
|
||||||
|
free(ctxt.sblk);
|
||||||
|
ctxt.sblk = NULL;
|
||||||
|
ctxt.cur_dev = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sqfs_closedir(struct fs_dir_stream *dirs)
|
void sqfs_closedir(struct fs_dir_stream *dirs)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user