This will prevent a double free error if sqfs_close() is called twice.
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit
7e932ac790b3615a67a3c24041c194aa748c0d98]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I31166f8f9d6ec6d4772e7b51b5d0bb8d20ef1a4b
if (sqfs_disk_read(0, 1, *sblk) != 1) {
free(*sblk);
+ sblk = NULL;
return -EINVAL;
}
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)