summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrett Grandbois <brett.grandbois@opengear.com>2018-04-19 07:55:14 +1000
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>2018-04-19 10:41:16 +1000
commitb014b38f115dcc1b47e52f8b5f9eb219f75ef071 (patch)
tree08ba3de7dce364f903d53c76b044aa29af5cbc36
parentc41ffccdaf16b0820904c5dd2e5d7612bfbefc65 (diff)
downloadtalos-petitboot-b014b38f115dcc1b47e52f8b5f9eb219f75ef071.tar.gz
talos-petitboot-b014b38f115dcc1b47e52f8b5f9eb219f75ef071.zip
discover/syslinux-parser: clean up boot option list entries
in finalize loop or we can get duplicate boot entries as well as the memory leak Signed-off-by: Brett Grandbois <brett.grandbois@opengear.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
-rw-r--r--discover/syslinux-parser.c7
1 files changed, 6 insertions, 1 deletions
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)
OpenPOWER on IntegriCloud