tests/plugin: prevent uninitialized warning

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>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20200206093238.203984-1-kuhn.chenqun@huawei.com>
[AJB: uses Thomas's single line allocation]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200225124710.14152-13-alex.bennee@linaro.org>
master
Chen Qun 2020-02-25 12:47:03 +00:00 committed by Alex Bennée
parent dcc474c69e
commit 4133686110
2 changed files with 4 additions and 5 deletions

View File

@ -22,9 +22,9 @@ static bool do_inline;
static void plugin_exit(qemu_plugin_id_t id, void *p)
{
g_autofree gchar *out;
out = g_strdup_printf("bb's: %" PRIu64", insns: %" PRIu64 "\n",
bb_count, insn_count);
g_autofree gchar *out = g_strdup_printf(
"bb's: %" PRIu64", insns: %" PRIu64 "\n",
bb_count, insn_count);
qemu_plugin_outs(out);
}

View File

@ -44,8 +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;
out = g_strdup_printf("insns: %" PRIu64 "\n", insn_count);
g_autofree gchar *out = g_strdup_printf("insns: %" PRIu64 "\n", insn_count);
qemu_plugin_outs(out);
}