From 413368611039ce435e74fd0ce1b677ccc08a380e Mon Sep 17 00:00:00 2001 From: Chen Qun Date: Tue, 25 Feb 2020 12:47:03 +0000 Subject: tests/plugin: prevent uninitialized warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Chen Qun Reviewed-by: Thomas Huth Message-Id: <20200206093238.203984-1-kuhn.chenqun@huawei.com> [AJB: uses Thomas's single line allocation] Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Message-Id: <20200225124710.14152-13-alex.bennee@linaro.org> --- tests/plugin/bb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/plugin/bb.c') diff --git a/tests/plugin/bb.c b/tests/plugin/bb.c index f30bea0..df19fd3 100644 --- a/tests/plugin/bb.c +++ b/tests/plugin/bb.c @@ -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); } -- cgit v1.1