dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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