Blame SOURCES/0350-mmap-Fix-memory-leak-when-iterating-over-mapped-memo.patch

b1bcb2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
b1bcb2
From: Darren Kenny <darren.kenny@oracle.com>
b1bcb2
Date: Thu, 3 Dec 2020 14:39:45 +0000
b1bcb2
Subject: [PATCH] mmap: Fix memory leak when iterating over mapped memory
b1bcb2
b1bcb2
When returning from grub_mmap_iterate() the memory allocated to present
b1bcb2
is not being released causing it to leak.
b1bcb2
b1bcb2
Fixes: CID 96655
b1bcb2
b1bcb2
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
b1bcb2
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
b1bcb2
---
b1bcb2
 grub-core/mmap/mmap.c | 2 ++
b1bcb2
 1 file changed, 2 insertions(+)
b1bcb2
b1bcb2
diff --git a/grub-core/mmap/mmap.c b/grub-core/mmap/mmap.c
b1bcb2
index 7ebf32e1e5e..8bf235f3400 100644
b1bcb2
--- a/grub-core/mmap/mmap.c
b1bcb2
+++ b/grub-core/mmap/mmap.c
b1bcb2
@@ -270,6 +270,7 @@ grub_mmap_iterate (grub_memory_hook_t hook, void *hook_data)
b1bcb2
 		   hook_data))
b1bcb2
 	{
b1bcb2
 	  grub_free (ctx.scanline_events);
b1bcb2
+	  grub_free (present);
b1bcb2
 	  return GRUB_ERR_NONE;
b1bcb2
 	}
b1bcb2
 
b1bcb2
@@ -282,6 +283,7 @@ grub_mmap_iterate (grub_memory_hook_t hook, void *hook_data)
b1bcb2
     }
b1bcb2
 
b1bcb2
   grub_free (ctx.scanline_events);
b1bcb2
+  grub_free (present);
b1bcb2
   return GRUB_ERR_NONE;
b1bcb2
 }
b1bcb2