From: t.feng Date: Tue, 29 Nov 2022 09:14:13 +0000 (+0800) Subject: fs/iso9660: Fix memory leaks in grub_iso9660_susp_iterate() X-Git-Tag: grub-2.12-rc1~198 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7338cbe91a24ee9639597a0d8bebc32b8b46c26c;p=thirdparty%2Fgrub.git fs/iso9660: Fix memory leaks in grub_iso9660_susp_iterate() Fixes: 99373ce47 (* grub-core/fs/iso9660.c: Remove nested functions) Signed-off-by: t.feng Reviewed-by: Thomas Schmitt Reviewed-by: Daniel Kiper --- diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c index 91817ec1f..df9f7783b 100644 --- a/grub-core/fs/iso9660.c +++ b/grub-core/fs/iso9660.c @@ -279,7 +279,10 @@ grub_iso9660_susp_iterate (grub_fshelp_node_t node, grub_off_t off, /* Load a part of the System Usage Area. */ err = read_node (node, off, sua_size, sua); if (err) - return err; + { + grub_free (sua); + return err; + } for (entry = (struct grub_iso9660_susp_entry *) sua; (char *) entry < (char *) sua + sua_size - 1 && entry->len > 0; entry = (struct grub_iso9660_susp_entry *) @@ -309,7 +312,10 @@ grub_iso9660_susp_iterate (grub_fshelp_node_t node, grub_off_t off, err = grub_disk_read (node->data->disk, ce_block, off, sua_size, sua); if (err) - return err; + { + grub_free (sua); + return err; + } entry = (struct grub_iso9660_susp_entry *) sua; }