nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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