qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: xiaoqiang zhao <zxq_yx_007@163.com>
To: Li Qiang <liq3ea@163.com>,
	berrange@redhat.com, marcandre.lureau@redhat.com
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH] tests: fix a memory in test_socket_unix_abstract_good
Date: Thu, 4 Jun 2020 07:10:07 +0800	[thread overview]
Message-ID: <e3a262a7-fbfb-14a3-f4df-7ccafc803d13@163.com> (raw)
In-Reply-To: <20200603161409.54682-1-liq3ea@163.com>

在 2020/6/4 上午12:14, Li Qiang 写道:
> After build qemu with '-fsanitize=address' extra-cflags,
> 'make check' show following leak:
>
> =================================================================
> ==44580==ERROR: LeakSanitizer: detected memory leaks
>
> Direct leak of 2500 byte(s) in 1 object(s) allocated from:
>      #0 0x7f1b5a8b8d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
>      #1 0x7f1b5a514b10 in g_malloc0 (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x51b10)
>      #2 0xd79ea4e4c0ad31c3  (<unknown module>)
>
> SUMMARY: AddressSanitizer: 2500 byte(s) leaked in 1 allocation(s).
>
> Call 'g_rand_free' in the end of function to avoid this.
>
> Fixes: 4d3a329af59("tests/util-sockets: add abstract unix socket cases")
> Signed-off-by: Li Qiang <liq3ea@163.com>
> ---
>   tests/test-util-sockets.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/tests/test-util-sockets.c b/tests/test-util-sockets.c
> index 2ca1e99f17..ca6671f9bf 100644
> --- a/tests/test-util-sockets.c
> +++ b/tests/test-util-sockets.c
> @@ -312,6 +312,7 @@ static void test_socket_unix_abstract_good(void)
>       g_thread_join(serv);
>   
>       g_free(abstract_sock_name);
> +    g_rand_free(r);
>   }
>   #endif
>   

Reviewed-by:  xiaoqiang zhao <zxq_yx_007@163.com>



  parent reply	other threads:[~2020-06-03 23:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-03 16:14 [PATCH] tests: fix a memory in test_socket_unix_abstract_good Li Qiang
2020-06-03 17:25 ` Philippe Mathieu-Daudé
2020-06-03 23:10 ` xiaoqiang zhao [this message]
2020-06-18  6:12 ` Li Qiang
2020-06-24 10:56   ` Daniel P. Berrangé
2020-08-13 16:32     ` Li Qiang
2020-08-25  5:59       ` Markus Armbruster

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=e3a262a7-fbfb-14a3-f4df-7ccafc803d13@163.com \
    --to=zxq_yx_007@163.com \
    --cc=berrange@redhat.com \
    --cc=liq3ea@163.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).