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

Richard Genoud richard.genoud at posteo.net
Tue Nov 3 12:11:14 CET 2020


data_buffer was allocated in a loop and freed only once.

Signed-off-by: Richard Genoud <richard.genoud at 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 a9e803cbac2..cfea313e34b 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);


More information about the U-Boot mailing list