nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0412-syslinux-Fix-memory-leak-while-parsing.patch

9723a8
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
9723a8
From: Darren Kenny <darren.kenny@oracle.com>
9723a8
Date: Thu, 26 Nov 2020 15:31:53 +0000
9723a8
Subject: [PATCH] syslinux: Fix memory leak while parsing
9723a8
9723a8
In syslinux_parse_real() the 2 points where return is being called
9723a8
didn't release the memory stored in buf which is no longer required.
9723a8
9723a8
Fixes: CID 176634
9723a8
9723a8
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
9723a8
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
9723a8
---
9723a8
 grub-core/lib/syslinux_parse.c | 6 +++++-
9723a8
 1 file changed, 5 insertions(+), 1 deletion(-)
9723a8
9723a8
diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c
3efed6
index 83e7bdb9161..f477feff1c3 100644
9723a8
--- a/grub-core/lib/syslinux_parse.c
9723a8
+++ b/grub-core/lib/syslinux_parse.c
9723a8
@@ -737,7 +737,10 @@ syslinux_parse_real (struct syslinux_menu *menu)
9723a8
 		  && grub_strncasecmp ("help", ptr3, ptr4 - ptr3) == 0))
9723a8
 	    {
9723a8
 	      if (helptext (ptr5, file, menu))
9723a8
-		return 1;
9723a8
+		{
9723a8
+		  grub_free (buf);
9723a8
+		  return 1;
9723a8
+		}
9723a8
 	      continue;
9723a8
 	    }
9723a8
 
9723a8
@@ -757,6 +760,7 @@ syslinux_parse_real (struct syslinux_menu *menu)
9723a8
     }
9723a8
  fail:
9723a8
   grub_file_close (file);
9723a8
+  grub_free (buf);
9723a8
   return err;
9723a8
 }
9723a8