]> git.ipfire.org Git - thirdparty/grub.git/commit
fs/affs: Fix resource leaks
authorAlec Brown <alec.r.brown@oracle.com>
Thu, 3 Feb 2022 00:08:21 +0000 (19:08 -0500)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 8 Feb 2022 15:06:50 +0000 (16:06 +0100)
commitebf32bc4e9561800b9fda59560277cbee6302643
tree12deadc2bbae0d1f47e05f532b84e7e6f6df97d1
parent049efdd72eb7baa7b2bf8884391ee7fe650da5a0
fs/affs: Fix resource leaks

In commit 178ac5107389 (affs: Fix memory leaks), fixes were made to
grub_affs_iterate_dir() to prevent memory leaks from occurring after it
returns without freeing node. However, there were still some instances
where node was causing a memory leak when the function returns after
calling grub_affs_create_node(). In this function, new memory is
allocated to node but doesn't get freed until the hook() function is
called near the end. Before hook() is called, node should be freed in
grub_affs_create_node() before returning out of it.

Fixes: 178ac5107389 (affs: Fix memory leaks)
Fixes: CID 73759
Signed-off-by: Alec Brown <alec.r.brown@oracle.com>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/fs/affs.c