nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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