From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: tony.nguyen@bt.com, armbru@redhat.com,
Mao Zhongyi <maozhongyi@cmss.chinamobile.com>,
laurent@vivier.eu
Subject: Re: [Qemu-devel] [PATCH 1/3] tests/migration: mem leak fix
Date: Tue, 10 Sep 2019 19:52:42 +0100 [thread overview]
Message-ID: <87d0g80yrp.fsf@linaro.org> (raw)
In-Reply-To: <20190910120927.1669283-2-maozhongyi@cmss.chinamobile.com>
Mao Zhongyi <maozhongyi@cmss.chinamobile.com> writes:
> Cc: armbru@redhat.com
> Cc: laurent@vivier.eu
> Cc: tony.nguyen@bt.com
>
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
> ---
> tests/migration/stress.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tests/migration/stress.c b/tests/migration/stress.c
> index d9aa4afe92..e6c9a6b243 100644
> --- a/tests/migration/stress.c
> +++ b/tests/migration/stress.c
> @@ -181,6 +181,8 @@ static int stressone(unsigned long long ramsizeMB)
> if (!ram) {
> fprintf(stderr, "%s (%05d): ERROR: cannot allocate %llu MB of RAM: %s\n",
> argv0, gettid(), ramsizeMB, strerror(errno));
> + if (data)
> + free(data);
I wonder if it's worth using the glib macros here so:
g_autofree char *data = g_malloc(PAGE_SIZE);
and the same for ram. You can then drop the frees.
> return -1;
> }
> if (!data) {
--
Alex Bennée
next prev parent reply other threads:[~2019-09-10 18:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-10 12:09 [Qemu-devel] [PATCH 0/3] some fix in tests/migration Mao Zhongyi
2019-09-10 12:09 ` [Qemu-devel] [PATCH 1/3] tests/migration: mem leak fix Mao Zhongyi
2019-09-10 18:52 ` Alex Bennée [this message]
2019-09-11 1:35 ` maozy
2019-09-10 12:09 ` [Qemu-devel] [PATCH 2/3] tests/migration: fix a typo in comment Mao Zhongyi
2019-09-10 18:49 ` Alex Bennée
2019-09-10 12:09 ` [Qemu-devel] [PATCH 3/3] tests/migration:fix unreachable path in stress test Mao Zhongyi
2019-09-10 16:11 ` [Qemu-devel] [PATCH 0/3] some fix in tests/migration no-reply
2019-09-10 23:07 ` no-reply
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=87d0g80yrp.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=armbru@redhat.com \
--cc=laurent@vivier.eu \
--cc=maozhongyi@cmss.chinamobile.com \
--cc=qemu-devel@nongnu.org \
--cc=tony.nguyen@bt.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.