* Marc-André Lureau (marcandre.lur...@redhat.com) wrote:
> Spotted thanks to ASAN:
> QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 tests/migration-test -p 
> /x86_64/migration/bad_dest
> 
> ==30302==ERROR: LeakSanitizer: detected memory leaks
> 
> Direct leak of 48 byte(s) in 1 object(s) allocated from:
>     #0 0x7f60efba1a38 in __interceptor_calloc (/lib64/libasan.so.4+0xdea38)
>     #1 0x7f60eef3cf75 in g_malloc0 ../glib/gmem.c:124
>     #2 0x55ca9094702c in error_copy /home/elmarco/src/qemu/util/error.c:203
>     #3 0x55ca9037a30f in migrate_set_error 
> /home/elmarco/src/qemu/migration/migration.c:1139
>     #4 0x55ca9037a462 in migrate_fd_error 
> /home/elmarco/src/qemu/migration/migration.c:1150
>     #5 0x55ca9038162b in migrate_fd_connect 
> /home/elmarco/src/qemu/migration/migration.c:2411
>     #6 0x55ca90386e41 in migration_channel_connect 
> /home/elmarco/src/qemu/migration/channel.c:81
>     #7 0x55ca9038335e in socket_outgoing_migration 
> /home/elmarco/src/qemu/migration/socket.c:85
>     #8 0x55ca9083dd3a in qio_task_complete 
> /home/elmarco/src/qemu/io/task.c:142
>     #9 0x55ca9083d6cc in gio_task_thread_result 
> /home/elmarco/src/qemu/io/task.c:88
>     #10 0x7f60eef37317 in g_idle_dispatch ../glib/gmain.c:5552
>     #11 0x7f60eef3490b in g_main_dispatch ../glib/gmain.c:3182
>     #12 0x7f60eef357ac in g_main_context_dispatch ../glib/gmain.c:3847
>     #13 0x55ca90927231 in glib_pollfds_poll 
> /home/elmarco/src/qemu/util/main-loop.c:214
>     #14 0x55ca90927420 in os_host_main_loop_wait 
> /home/elmarco/src/qemu/util/main-loop.c:261
>     #15 0x55ca909275fa in main_loop_wait 
> /home/elmarco/src/qemu/util/main-loop.c:515
>     #16 0x55ca8fc1c2a4 in main_loop /home/elmarco/src/qemu/vl.c:1942
>     #17 0x55ca8fc2eb3a in main /home/elmarco/src/qemu/vl.c:4724
>     #18 0x7f60e4082009 in __libc_start_main (/lib64/libc.so.6+0x21009)
> 
> Indirect leak of 45 byte(s) in 1 object(s) allocated from:
>     #0 0x7f60efba1850 in malloc (/lib64/libasan.so.4+0xde850)
>     #1 0x7f60eef3cf0c in g_malloc ../glib/gmem.c:94
>     #2 0x7f60eef3d1cf in g_malloc_n ../glib/gmem.c:331
>     #3 0x7f60eef596eb in g_strdup ../glib/gstrfuncs.c:363
>     #4 0x55ca90947085 in error_copy /home/elmarco/src/qemu/util/error.c:204
>     #5 0x55ca9037a30f in migrate_set_error 
> /home/elmarco/src/qemu/migration/migration.c:1139
>     #6 0x55ca9037a462 in migrate_fd_error 
> /home/elmarco/src/qemu/migration/migration.c:1150
>     #7 0x55ca9038162b in migrate_fd_connect 
> /home/elmarco/src/qemu/migration/migration.c:2411
>     #8 0x55ca90386e41 in migration_channel_connect 
> /home/elmarco/src/qemu/migration/channel.c:81
>     #9 0x55ca9038335e in socket_outgoing_migration 
> /home/elmarco/src/qemu/migration/socket.c:85
>     #10 0x55ca9083dd3a in qio_task_complete 
> /home/elmarco/src/qemu/io/task.c:142
>     #11 0x55ca9083d6cc in gio_task_thread_result 
> /home/elmarco/src/qemu/io/task.c:88
>     #12 0x7f60eef37317 in g_idle_dispatch ../glib/gmain.c:5552
>     #13 0x7f60eef3490b in g_main_dispatch ../glib/gmain.c:3182
>     #14 0x7f60eef357ac in g_main_context_dispatch ../glib/gmain.c:3847
>     #15 0x55ca90927231 in glib_pollfds_poll 
> /home/elmarco/src/qemu/util/main-loop.c:214
>     #16 0x55ca90927420 in os_host_main_loop_wait 
> /home/elmarco/src/qemu/util/main-loop.c:261
>     #17 0x55ca909275fa in main_loop_wait 
> /home/elmarco/src/qemu/util/main-loop.c:515
>     #18 0x55ca8fc1c2a4 in main_loop /home/elmarco/src/qemu/vl.c:1942
>     #19 0x55ca8fc2eb3a in main /home/elmarco/src/qemu/vl.c:4724
>     #20 0x7f60e4082009 in __libc_start_main (/lib64/libc.so.6+0x21009)
> 
> Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com>

Reviewed-by: Dr. David Alan Gilbert <dgilb...@redhat.com>

> ---
>  migration/migration.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/migration/migration.c b/migration/migration.c
> index e345d0cc7e..62c243d2d4 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -2541,6 +2541,7 @@ static void migration_instance_finalize(Object *obj)
>      g_free(params->tls_hostname);
>      g_free(params->tls_creds);
>      qemu_sem_destroy(&ms->pause_sem);
> +    error_free(ms->error);
>  }
>  
>  static void migration_instance_init(Object *obj)
> -- 
> 2.16.2.346.g9779355e34
> 
--
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK

Reply via email to