diff mbox series

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

Message ID 20201014080622.14970-17-richard.genoud@posteo.net
State Superseded
Delegated to: Tom Rini
Headers show
Series fs/squashfs: fix memory leaks and introduce exists() function | expand

Commit Message

Richard Genoud Oct. 14, 2020, 8:06 a.m. UTC
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 mbox series

Patch

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);