On Wed, Jun 21, 2023 at 11:42:45AM +0200, Juan Quintela wrote: > Peter Xu <pet...@redhat.com> wrote: > > On Fri, Jun 09, 2023 at 12:49:04AM +0200, Juan Quintela wrote: > >> Signed-off-by: Juan Quintela <quint...@redhat.com> > >> --- > >> tests/qtest/migration-test.c | 9 ++++----- > >> 1 file changed, 4 insertions(+), 5 deletions(-) > >> > >> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c > >> index 73b2f01427..95ccc9bce7 100644 > >> --- a/tests/qtest/migration-test.c > >> +++ b/tests/qtest/migration-test.c > >> @@ -681,9 +681,6 @@ static int test_migrate_start(QTestState **from, > >> QTestState **to, > >> "-object memory-backend-file,id=mem0,size=%s" > >> ",mem-path=%s,share=on -numa node,memdev=mem0", > >> memory_size, shmem_path); > >> - } else { > >> - shmem_path = NULL; > >> - shmem_opts = g_strdup(""); > >> } > >> > >> cmd_source = g_strdup_printf("-accel kvm%s -accel tcg%s%s " > >> @@ -696,7 +693,8 @@ static int test_migrate_start(QTestState **from, > >> QTestState **to, > >> machine_opts ? " -machine " : "", > >> machine_opts ? machine_opts : "", > >> memory_size, tmpfs, > >> - arch_source, shmem_opts, > >> + arch_source, > >> + shmem_opts ? shmem_opts : "", > >> args->opts_source ? args->opts_source : > >> "", > >> ignore_stderr ? ignore_stderr : ""); > >> > >> @@ -718,7 +716,8 @@ static int test_migrate_start(QTestState **from, > >> QTestState **to, > >> machine_opts ? " -machine " : "", > >> machine_opts ? machine_opts : "", > >> memory_size, tmpfs, uri, > >> - arch_target, shmem_opts, > >> + arch_target, > >> + shmem_opts ? shmem_opts : "", > > > > Isn't this adding duplications instead? > > I don't follow. > > > Meanwhile, shmem_opts right now is auto-free. If we do this we don't need > > it to be auto-free anymore.. > > We need. > It can still be from g_strdup_printf(). > > What this patch change is that it will never be (again) "". > > It is going to be NULL or a real string, like all the other options. > The real string is generated, so it needs to be auto_free.
Ah ok.. after I read some other reply I think I see what you mean. Reviewed-by: Peter Xu <pet...@redhat.com> -- Peter Xu