From: "Alex Bennée" <alex.bennee@linaro.org>
To: kuhn.chenqun@huawei.com
Cc: qemu-trivial@nongnu.org, richard.henderson@linaro.org,
qemu-devel@nongnu.org, zhang.zhanghailiang@huawei.com
Subject: Re: [PATCH] tests/plugin: prevent uninitialized warning
Date: Thu, 06 Feb 2020 12:45:33 +0000 [thread overview]
Message-ID: <87d0ar995e.fsf@linaro.org> (raw)
In-Reply-To: <20200206093238.203984-1-kuhn.chenqun@huawei.com>
kuhn.chenqun@huawei.com writes:
> From: Chen Qun <kuhn.chenqun@huawei.com>
>
> According to the glibc function requirements, we need initialise
> the variable. Otherwise there will be compilation warnings:
>
> glib-autocleanups.h:28:3: warning: ‘out’ may be
> used uninitialized in this function [-Wmaybe-uninitialized]
> g_free (*pp);
> ^~~~~~~~~~~~
>
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Queued to plugins/next with Thomas' single line suggestion, thanks.
> ---
> tests/plugin/bb.c | 2 +-
> tests/plugin/insn.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tests/plugin/bb.c b/tests/plugin/bb.c
> index f30bea08dc..8b9da23a04 100644
> --- a/tests/plugin/bb.c
> +++ b/tests/plugin/bb.c
> @@ -22,7 +22,7 @@ static bool do_inline;
>
> static void plugin_exit(qemu_plugin_id_t id, void *p)
> {
> - g_autofree gchar *out;
> + g_autofree gchar *out = NULL;
> out = g_strdup_printf("bb's: %" PRIu64", insns: %" PRIu64 "\n",
> bb_count, insn_count);
> qemu_plugin_outs(out);
> diff --git a/tests/plugin/insn.c b/tests/plugin/insn.c
> index 0a8f5a0000..c83b1c0157 100644
> --- a/tests/plugin/insn.c
> +++ b/tests/plugin/insn.c
> @@ -44,7 +44,7 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)
>
> static void plugin_exit(qemu_plugin_id_t id, void *p)
> {
> - g_autofree gchar *out;
> + g_autofree gchar *out = NULL;
> out = g_strdup_printf("insns: %" PRIu64 "\n", insn_count);
> qemu_plugin_outs(out);
> }
--
Alex Bennée
next prev parent reply other threads:[~2020-02-06 12:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-06 9:32 [PATCH] tests/plugin: prevent uninitialized warning kuhn.chenqun
2020-02-06 10:19 ` Thomas Huth
2020-02-06 12:45 ` Alex Bennée [this message]
2020-02-06 13:25 ` Chenqun (kuhn)
2020-02-06 16:22 ` Alex Bennée
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=87d0ar995e.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=kuhn.chenqun@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=richard.henderson@linaro.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).