diff options
author | Phillip Lougher <phillip@squashfs.org.uk> | 2014-04-18 04:36:55 +0100 |
---|---|---|
committer | Phillip Lougher <phillip@squashfs.org.uk> | 2014-04-18 04:36:55 +0100 |
commit | 7d7f2da27d5c39de89c5fae61eb611666f297c03 (patch) | |
tree | 5f5a2639682d3128d678d1294295aa3a00647efb | |
parent | 9d48721b145e05b6b1a26748a200eab0566c6e13 (diff) | |
download | squashfs-tools-7d7f2da27d5c39de89c5fae61eb611666f297c03.tar.gz |
read_fs: scan_inode_table(), fix memory leak on filesystem corruption
Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
-rw-r--r-- | squashfs-tools/read_fs.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/squashfs-tools/read_fs.c b/squashfs-tools/read_fs.c index 820ee39..ca84460 100644 --- a/squashfs-tools/read_fs.c +++ b/squashfs-tools/read_fs.c @@ -281,8 +281,10 @@ int scan_inode_table(int fd, long long start, long long end, (block_list[i]); if(inode.fragment != SQUASHFS_INVALID_FRAG && - inode.fragment >= sBlk->fragments) + inode.fragment >= sBlk->fragments) { + free(block_list); goto corrupted; + } add_file(start, inode.file_size, file_bytes, block_list, blocks, inode.fragment, @@ -335,8 +337,10 @@ int scan_inode_table(int fd, long long start, long long end, (block_list[i]); if(inode.fragment != SQUASHFS_INVALID_FRAG && - inode.fragment >= sBlk->fragments) + inode.fragment >= sBlk->fragments) { + free(block_list); goto corrupted; + } add_file(start, inode.file_size, file_bytes, block_list, blocks, inode.fragment, |