[PATCH 8/9] fs/squash4: Fix memeory leak in grub_squash_iterate_dir

2022-11-19 Thread t.feng via Grub-devel
Fix memory leaks in grub_squash_iterate_dir. Fixes: 20dd511c8(Handle "." and ".." on squashfs.) Signed-off-by: "t.feng" --- grub-core/fs/squash4.c | 20 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/grub-core/fs/squash4.c b/grub-core/fs/squash4.c index 02b1

[PATCH 4/9] fs/ntfs: Fix memory leak in grub_ntfs_read_symlink

2022-11-19 Thread t.feng via Grub-devel
Fix memory leaks in grub_ntfs_read_symlink. Fixes: 5773fb641(Support NTFS reparse points.) Signed-off-by: "t.feng" --- grub-core/fs/ntfs.c | 26 ++ 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c index 3511e4e2c..e

[PATCH 0/9] fix memory leaks in fs module

2022-11-19 Thread t.feng via Grub-devel
Hi all, I am doing code review in grub-core/fs module and I found some memory leaks. * t.feng (9): fs/affs:Fix memory leaks in grub_affs_create_node fs/btrfs: Fix memory leak in find_path fs/minix: Fix memory leak in grub_minix_lookup_symlink fs/ntfs: Fix memory le

[PATCH 9/9] fs/xfs: Fix memory leaks in xfs

2022-11-19 Thread t.feng via Grub-devel
Fix memory leaks in xfs. Signed-off-by: "t.feng" --- grub-core/fs/xfs.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c index d6de7f1a2..b67407690 100644 --- a/grub-core/fs/xfs.c +++ b/grub-core/fs/xfs.c @@ -585,7 +585,10 @@

[PATCH 7/9] fs/iso9660: Fix memory leak in grub_iso9660_susp_iterate

2022-11-19 Thread t.feng via Grub-devel
Fix memory leak in grub_iso9660_susp_iterate. Fixes: 99373ce47(iso9660.c: Remove nested functions.) Signed-off-by: "t.feng" --- grub-core/fs/iso9660.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c index 91817ec1f..

[PATCH 5/9] fs/bfs: Fix memory leak in read_bfs_file

2022-11-19 Thread t.feng via Grub-devel
Fix memory leaks in read_bfs_file. l1_entries and l2_entries are forgotten to be freed if end of reading file. Fixes: 5825b3794(BFS implementation based on the specification.) Signed-off-by: "t.feng" --- grub-core/fs/bfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/grub-core/fs/bfs.c

[PATCH 1/9] fs/affs:Fix memory leaks in grub_affs_create_node

2022-11-19 Thread t.feng via Grub-devel
hashtable is unfreed in case GRUB_AFFS_FILETYPE_HARDLINK if grub_disk_read failed. Because, if grub_affs_create_node return not zero, the hashtable should be freed. By the way hashtable is unused in grub_affs_create_node, so we can remove the parameter and take care of it in grub_affs_iterate_dir.

[PATCH 3/9] fs/minix: Fix memory leak in grub_minix_lookup_symlink

2022-11-19 Thread t.feng via Grub-devel
Fix memory leaks in grub_minix_lookup_symlink. Fixes: a07e6ad01(Remove variable length arrays) Signed-off-by: "t.feng" --- grub-core/fs/minix.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/grub-core/fs/minix.c b/grub-core/fs/minix.c index 953df1191..2176b6e93

[PATCH 6/9] fs/hfsplus: Fix memory leak in grub_hfsplus_btree_search

2022-11-19 Thread t.feng via Grub-devel
Fix memory leak in grub_hfsplus_btree_search. Fixes: 58ea11d5b(Don't fetch a key beyond the end of the node) Signed-off-by: "t.feng" --- grub-core/fs/hfsplus.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c index 6337cbfcb

[PATCH 2/9] fs/btrfs: Fix memory leak in find_path

2022-11-19 Thread t.feng via Grub-devel
Fix memory leak in find_path. Fixs: 82591fa6e(Make / in btrfe refer to real root) Signed-off-by: "t.feng" --- grub-core/fs/btrfs.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c index ec72f7be3..19bff4610 100644 --- a/grub-c

Re: [PATCH 7/9] fs/iso9660: Fix memory leak in grub_iso9660_susp_iterate

2022-11-19 Thread Thomas Schmitt
Hi, on Sat, 19 Nov 2022 18:39:44 +0800, t.feng via Grub-devel wrote: > Fix memory leak in grub_iso9660_susp_iterate. > > Fixes: 99373ce47(iso9660.c: Remove nested functions.) > > Signed-off-by: "t.feng" Reviewed-by: Thomas Schmitt Have a nice day :) Thomas _

Possible memory fault in fs/iso9660

2022-11-19 Thread Thomas Schmitt
Hi, (Cc-ing t.feng in the hope that this issue can become part of the code review.) While reviewing "[PATCH 7/9]" by t.feng, i wonder whether there is a bug in grub_iso9660_susp_iterate() in regard to the end of the SUSP data: for (entry = (struct grub_iso9660_susp_entry *) sua; (char *) entry

Re: Possible memory fault in fs/iso9660 (correction)

2022-11-19 Thread Thomas Schmitt
Hi, i wrote: > I think the loop end condition should use 4 rather than 1: > (char *) entry < (char *) sua + sua_size - 4 && entry->len > 0 Urm ... better "3 rather than 1": (char *) entry < (char *) sua + sua_size - 3 && entry->len > 0 The memory fault by entry->len will appear if