]> git.proxmox.com Git - mirror_qemu.git/commitdiff
test-logging: Fix -Werror=maybe-uninitialized warning
authorMiroslav Rezanina <mrezanin@redhat.com>
Tue, 21 Jan 2020 09:28:13 +0000 (10:28 +0100)
committerThomas Huth <thuth@redhat.com>
Tue, 4 Feb 2020 08:00:57 +0000 (09:00 +0100)
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 <mrezanin@redhat.com>
Message-Id: <63b0fcedf7dfe799c8210b113e5dccf32414a89d.1579598240.git.mrezanin@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Robert Foley <robert.foley@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
tests/test-logging.c

index 1e646f045dcd458d014a290e9167a911c38f8f1f..6387e4933f388094be8384174e31617a4982afdb 100644 (file)
@@ -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);