[PATCH v3 1/2] discover/syslinux-parser: clean up boot option list entries
Brett Grandbois
brett.grandbois at opengear.com
Thu Apr 19 07:55:14 AEST 2018
in finalize loop or we can get duplicate boot entries as well as the
memory leak
Signed-off-by: Brett Grandbois <brett.grandbois at opengear.com>
---
discover/syslinux-parser.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/discover/syslinux-parser.c b/discover/syslinux-parser.c
index d948765..b127494 100644
--- a/discover/syslinux-parser.c
+++ b/discover/syslinux-parser.c
@@ -285,7 +285,7 @@ static void syslinux_process_pair(struct conf_context *conf, const char *name, c
static void syslinux_finalize(struct conf_context *conf)
{
struct syslinux_options *state = conf->parser_info;
- struct syslinux_boot_option *syslinux_opt;
+ struct syslinux_boot_option *syslinux_opt, *tmp;
struct discover_context *dc = conf->dc;
struct discover_boot_option *d_opt;
bool implicit_image = true;
@@ -404,9 +404,14 @@ static void syslinux_finalize(struct conf_context *conf)
discover_context_add_boot_option(dc, d_opt);
continue;
+
fail:
talloc_free(d_opt);
}
+
+ list_for_each_entry_safe(&state->processed_options, syslinux_opt, tmp, list)
+ talloc_free(syslinux_opt);
+ list_init(&state->processed_options);
}
static int syslinux_parse(struct discover_context *dc)
--
2.7.4
More information about the Petitboot
mailing list