summaryrefslogtreecommitdiffstats
path: root/meta/recipes-bsp/grub/files/0028-syslinux-Fix-memory-leak-while-parsing.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-bsp/grub/files/0028-syslinux-Fix-memory-leak-while-parsing.patch')
-rw-r--r--meta/recipes-bsp/grub/files/0028-syslinux-Fix-memory-leak-while-parsing.patch43
1 files changed, 43 insertions, 0 deletions
diff --git a/meta/recipes-bsp/grub/files/0028-syslinux-Fix-memory-leak-while-parsing.patch b/meta/recipes-bsp/grub/files/0028-syslinux-Fix-memory-leak-while-parsing.patch
new file mode 100644
index 0000000000..d8c21d88f7
--- /dev/null
+++ b/meta/recipes-bsp/grub/files/0028-syslinux-Fix-memory-leak-while-parsing.patch
@@ -0,0 +1,43 @@
1From ea12feb69b6af93c7e2fa03df7ac3bd1f4edd599 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>
13
14Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/grub.git/commit/?id=95bc016dba94cab3d398dd74160665915cd08ad6]
15Signed-off-by: Marta Rybczynska <marta.rybczynska@huawei.com>
16---
17 grub-core/lib/syslinux_parse.c | 6 +++++-
18 1 file changed, 5 insertions(+), 1 deletion(-)
19
20diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c
21index 4afa992..3acc6b4 100644
22--- a/grub-core/lib/syslinux_parse.c
23+++ b/grub-core/lib/syslinux_parse.c
24@@ -737,7 +737,10 @@ syslinux_parse_real (struct syslinux_menu *menu)
25 && grub_strncasecmp ("help", ptr3, ptr4 - ptr3) == 0))
26 {
27 if (helptext (ptr5, file, menu))
28- return 1;
29+ {
30+ grub_free (buf);
31+ return 1;
32+ }
33 continue;
34 }
35
36@@ -757,6 +760,7 @@ syslinux_parse_real (struct syslinux_menu *menu)
37 }
38 fail:
39 grub_file_close (file);
40+ grub_free (buf);
41 return err;
42 }
43