From 24f7eeed9ad7f90975c2da44425d15b8f0837120 Mon Sep 17 00:00:00 2001 From: Miroslav Rezanina Date: Tue, 21 Jan 2020 10:28:13 +0100 Subject: [PATCH] test-logging: Fix -Werror=maybe-uninitialized warning Checking for uninitialized variables raises warning for file path variables in test_logfile_write and test_logfile_lock functions. To suppress this warning, initialize varibles to NULL. This is safe change as result of g_build_filename is stored to them before any usage. Signed-off-by: Miroslav Rezanina Message-Id: <63b0fcedf7dfe799c8210b113e5dccf32414a89d.1579598240.git.mrezanin@redhat.com> Reviewed-by: Thomas Huth Reviewed-by: Robert Foley Signed-off-by: Thomas Huth --- tests/test-logging.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test-logging.c b/tests/test-logging.c index 1e646f045d..6387e4933f 100644 --- a/tests/test-logging.c +++ b/tests/test-logging.c @@ -114,8 +114,8 @@ static void test_logfile_write(gconstpointer data) QemuLogFile *logfile2; gchar const *dir = data; Error *err = NULL; - g_autofree gchar *file_path; - g_autofree gchar *file_path1; + g_autofree gchar *file_path = NULL; + g_autofree gchar *file_path1 = NULL; FILE *orig_fd; /* @@ -157,7 +157,7 @@ static void test_logfile_lock(gconstpointer data) FILE *logfile; gchar const *dir = data; Error *err = NULL; - g_autofree gchar *file_path; + g_autofree gchar *file_path = NULL; file_path = g_build_filename(dir, "qemu_test_logfile_lock0.log", NULL); -- GitLab