On Thu, 2014-05-29 at 11:47 +0200, Igor Mammedov wrote: > ... fixes freeing constant from vl.c by machine_finalize() Nice cleanup, thanks!
Reviewed-by: Marcel Apfelbaum <marce...@redhat.com> > > Signed-off-by: Igor Mammedov <imamm...@redhat.com> > --- > hw/core/machine.c | 3 +++ > vl.c | 7 +------ > 2 files changed, 4 insertions(+), 6 deletions(-) > > diff --git a/hw/core/machine.c b/hw/core/machine.c > index cbba679..37bd676 100644 > --- a/hw/core/machine.c > +++ b/hw/core/machine.c > @@ -237,6 +237,8 @@ static void machine_set_firmware(Object *obj, const char > *value, Error **errp) > > static void machine_initfn(Object *obj) > { > + MachineState *ms = MACHINE(obj); > + > object_property_add_str(obj, "accel", > machine_get_accel, machine_set_accel, NULL); > object_property_add_bool(obj, "kernel_irqchip", > @@ -251,6 +253,7 @@ static void machine_initfn(Object *obj) > machine_get_kernel, machine_set_kernel, NULL); > object_property_add_str(obj, "initrd", > machine_get_initrd, machine_set_initrd, NULL); > + ms->kernel_cmdline = g_strdup(""); > object_property_add_str(obj, "append", > machine_get_append, machine_set_append, NULL); > object_property_add_str(obj, "dtb", > diff --git a/vl.c b/vl.c > index 0c15608..b0b1a35 100644 > --- a/vl.c > +++ b/vl.c > @@ -4269,14 +4269,9 @@ int main(int argc, char **argv, char **envp) > boot_strict = qemu_opt_get_bool(opts, "strict", false); > } > > - if (!kernel_cmdline) { > - kernel_cmdline = ""; > - current_machine->kernel_cmdline = (char *)kernel_cmdline; > - } > - > linux_boot = (kernel_filename != NULL); > > - if (!linux_boot && *kernel_cmdline != '\0') { > + if (!linux_boot && kernel_cmdline && *kernel_cmdline != '\0') { > fprintf(stderr, "-append only allowed with -kernel option\n"); > exit(1); > }