On Mon, May 14, 2018 at 06:19:12PM +0100, Daniel P. Berrangé wrote: > The multiboot code parses the initrd_filename twice, first to count how > many entries there are, and second to process each entry. This changes > the first loop to store the parse module names in a list, and the second > loop can now use these names. This avoids having to pass NULL to the > get_opt_value() method which means it can safely assume a non-NULL param. > > Signed-off-by: Daniel P. Berrangé <[email protected]> [...] > @@ -352,10 +350,10 @@ int load_multiboot(FWCfgState *fw_cfg, > mb_debug("mod_start: %p\nmod_end: %p\n cmdline: > "TARGET_FMT_plx, > (char *)mbs.mb_buf + offs, > (char *)mbs.mb_buf + offs + mb_mod_length, c); > - initrd_filename = next_initrd+1; > g_free(one_file); > - one_file = NULL; > - } while (not_last); > + tmpl = tmpl->next; > + } > + g_list_free(mods);
I thought this would cause double free of tmpl->data, but g_list_free() won't free the elements' data. Reviewed-by: Eduardo Habkost <[email protected]> Queueing on x86-next. -- Eduardo
