qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: Pan Nengyuan <pannengyuan@huawei.com>
Cc: zhang.zhanghailiang@huawei.com, euler.robot@huawei.com,
	dgilbert@redhat.com, qemu-devel@nongnu.org
Subject: Re: [PATCH 2/2] migration/multifd: Do error_free after migrate_set_error to avoid memleaks
Date: Wed, 06 May 2020 10:43:01 +0200	[thread overview]
Message-ID: <87zhalihd6.fsf@secure.mitica> (raw)
In-Reply-To: <20200506095416.26099-3-pannengyuan@huawei.com> (Pan Nengyuan's message of "Wed, 6 May 2020 05:54:16 -0400")

Pan Nengyuan <pannengyuan@huawei.com> wrote:
> When error happen in multifd_send_thread, it use error_copy to set migrate error in
> multifd_send_terminate_threads(). We should call error_free after it.
>
> Similarly, fix another two places in multifd_recv_thread/multifd_save_cleanup.
>
> The leak stack:
> Direct leak of 48 byte(s) in 1 object(s) allocated from:
>     #0 0x7f781af07cf0 in calloc (/lib64/libasan.so.5+0xefcf0)
>     #1 0x7f781a2ce22d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5322d)
>     #2 0x55ee1d075c17 in error_setv /mnt/sdb/backup/qemu/util/error.c:61
>     #3 0x55ee1d076464 in error_setg_errno_internal /mnt/sdb/backup/qemu/util/error.c:109
>     #4 0x55ee1cef066e in qio_channel_socket_writev /mnt/sdb/backup/qemu/io/channel-socket.c:569
>     #5 0x55ee1cee806b in qio_channel_writev /mnt/sdb/backup/qemu/io/channel.c:207
>     #6 0x55ee1cee806b in qio_channel_writev_all /mnt/sdb/backup/qemu/io/channel.c:171
>     #7 0x55ee1cee8248 in qio_channel_write_all /mnt/sdb/backup/qemu/io/channel.c:257
>     #8 0x55ee1ca12c9a in multifd_send_thread /mnt/sdb/backup/qemu/migration/multifd.c:657
>     #9 0x55ee1d0607fc in qemu_thread_start /mnt/sdb/backup/qemu/util/qemu-thread-posix.c:519
>     #10 0x7f78159ae2dd in start_thread (/lib64/libpthread.so.0+0x82dd)
>     #11 0x7f78156df4b2 in __GI___clone (/lib64/libc.so.6+0xfc4b2)
>
> Indirect leak of 52 byte(s) in 1 object(s) allocated from:
>     #0 0x7f781af07f28 in __interceptor_realloc (/lib64/libasan.so.5+0xeff28)
>     #1 0x7f78156f07d9 in __GI___vasprintf_chk (/lib64/libc.so.6+0x10d7d9)
>     #2 0x7f781a30ea6c in g_vasprintf (/lib64/libglib-2.0.so.0+0x93a6c)
>     #3 0x7f781a2e7cd0 in g_strdup_vprintf (/lib64/libglib-2.0.so.0+0x6ccd0)
>     #4 0x7f781a2e7d8c in g_strdup_printf (/lib64/libglib-2.0.so.0+0x6cd8c)
>     #5 0x55ee1d075c86 in error_setv /mnt/sdb/backup/qemu/util/error.c:65
>     #6 0x55ee1d076464 in error_setg_errno_internal /mnt/sdb/backup/qemu/util/error.c:109
>     #7 0x55ee1cef066e in qio_channel_socket_writev /mnt/sdb/backup/qemu/io/channel-socket.c:569
>     #8 0x55ee1cee806b in qio_channel_writev /mnt/sdb/backup/qemu/io/channel.c:207
>     #9 0x55ee1cee806b in qio_channel_writev_all /mnt/sdb/backup/qemu/io/channel.c:171
>     #10 0x55ee1cee8248 in qio_channel_write_all /mnt/sdb/backup/qemu/io/channel.c:257
>     #11 0x55ee1ca12c9a in multifd_send_thread /mnt/sdb/backup/qemu/migration/multifd.c:657
>     #12 0x55ee1d0607fc in qemu_thread_start /mnt/sdb/backup/qemu/util/qemu-thread-posix.c:519
>     #13 0x7f78159ae2dd in start_thread (/lib64/libpthread.so.0+0x82dd)
>     #14 0x7f78156df4b2 in __GI___clone (/lib64/libc.so.6+0xfc4b2)
>
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>

Reviewed-by: Juan Quintela <quintela@redhat.com>



  reply	other threads:[~2020-05-06  8:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-06  9:54 [PATCH 0/2] migration/multifd: fix two memleaks Pan Nengyuan
2020-05-06  9:54 ` [PATCH 1/2] migration/multifd: fix memleaks in multifd_new_send_channel_async Pan Nengyuan
2020-05-06  8:42   ` Juan Quintela
2020-05-06  9:54 ` [PATCH 2/2] migration/multifd: Do error_free after migrate_set_error to avoid memleaks Pan Nengyuan
2020-05-06  8:43   ` Juan Quintela [this message]
2020-05-07 15:55 ` [PATCH 0/2] migration/multifd: fix two memleaks 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=87zhalihd6.fsf@secure.mitica \
    --to=quintela@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=euler.robot@huawei.com \
    --cc=pannengyuan@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=zhang.zhanghailiang@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).