All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: qemu-devel@nongnu.org, Juan Quintela <quintela@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] migration: fix minor finalize leak
Date: Tue, 6 Mar 2018 17:56:19 +0000	[thread overview]
Message-ID: <20180306175619.GN3096@work-vm> (raw)
In-Reply-To: <20180306170959.3921-1-marcandre.lureau@redhat.com>

* Marc-André Lureau (marcandre.lureau@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.lureau@redhat.com>

Reviewed-by: Dr. David Alan Gilbert <dgilbert@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 / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2018-03-06 17:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-06 17:09 [Qemu-devel] [PATCH] migration: fix minor finalize leak Marc-André Lureau
2018-03-06 17:56 ` Dr. David Alan Gilbert [this message]
2018-03-06 23:17 ` Philippe Mathieu-Daudé
2018-03-09 14:48 ` Dr. David Alan Gilbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180306175619.GN3096@work-vm \
    --to=dgilbert@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.