1From 95bc016dba94cab3d398dd74160665915cd08ad6 Mon Sep 17 00:00:00 2001 2From: Darren Kenny <darren.kenny@oracle.com> 3Date: Thu, 26 Nov 2020 15:31:53 +0000 4Subject: [PATCH] syslinux: Fix memory leak while parsing 5 6In syslinux_parse_real() the 2 points where return is being called 7didn't release the memory stored in buf which is no longer required. 8 9Fixes: CID 176634 10 11Signed-off-by: Darren Kenny <darren.kenny@oracle.com> 12Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> 13Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com> 14--- 15 grub-core/lib/syslinux_parse.c | 6 +++++- 16 1 file changed, 5 insertions(+), 1 deletion(-) 17 18diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c 19index 4afa992..3acc6b4 100644 20--- a/grub-core/lib/syslinux_parse.c 21+++ b/grub-core/lib/syslinux_parse.c 22@@ -737,7 +737,10 @@ syslinux_parse_real (struct syslinux_menu *menu) 23 && grub_strncasecmp ("help", ptr3, ptr4 - ptr3) == 0)) 24 { 25 if (helptext (ptr5, file, menu)) 26- return 1; 27+ { 28+ grub_free (buf); 29+ return 1; 30+ } 31 continue; 32 } 33 34@@ -757,6 +760,7 @@ syslinux_parse_real (struct syslinux_menu *menu) 35 } 36 fail: 37 grub_file_close (file); 38+ grub_free (buf); 39 return err; 40 } 41 42-- 432.14.2 44 45