[PATCH 16/17] fs/squashfs: sqfs_read: fix another memory leak

Richard Genoud
2020-10-14T08:06:21Z

data_buffer was allocated in a loop and freed only once.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
---
fs/squashfs/sqfs.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c
index 6cd3ba9ce10..82bf1faf25f 100644
--- a/fs/squashfs/sqfs.c
+++ b/fs/squashfs/sqfs.c
@@ -1459,6 +1459,8 @@ int sqfs_read(const char *filename, void *buf, loff_t offset, loff_t len,
}

data_offset += table_size;
+ free(data_buffer);
+ data_buffer = NULL;
}

free(finfo.blk_sizes);