> On 17 Nov 2025, at 12:41 PM, Alec Brown via Grub-devel <[email protected]> > wrote: > > In the function grub_mmap_iterate(), memory is allocated to > "ctx.scanline_events" and "present" but isn't freed when error handling > grub_malloc(). Prior to returning grub_errno, these variables should be freed > to prevent a resource leak. > > Fixes: CID 96655 > > Signed-off-by: Alec Brown <[email protected]>
Reviewed-by: Sudhakar Kuppusamy <[email protected]> Thanks, Sudhakar > --- > grub-core/mmap/mmap.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/grub-core/mmap/mmap.c b/grub-core/mmap/mmap.c > index 8f03b7765..7c7d3911c 100644 > --- a/grub-core/mmap/mmap.c > +++ b/grub-core/mmap/mmap.c > @@ -242,8 +242,12 @@ grub_mmap_iterate (grub_memory_hook_t hook, void > *hook_data) > else > { > struct mm_list *n = grub_malloc (sizeof (*n)); > - if (n == NULL) > - return grub_errno; > + if (n == NULL) > + { > + grub_free (ctx.scanline_events); > + grub_free (present); > + return grub_errno; > + } > > n->val = ctx.scanline_events[i].memtype; > n->present = 1; > -- > 2.27.0 > > > _______________________________________________ > Grub-devel mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/grub-devel _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
