]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
qemu-ga: Fix null pointer passed to unlink in failure branch
authorStefan Weil <sw@weilnetz.de>
Fri, 24 Aug 2012 05:03:03 +0000 (07:03 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 30 Aug 2012 19:54:16 +0000 (14:54 -0500)
Clang reports this warning:

Null pointer passed as an argument to a 'nonnull' parameter

Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 4bdb1a3059d7d3a931de0748a2eec39a0ab41b4e)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qemu-ga.c

index e7f9edbc705833cb9ca6d9894d19de8f00bda092..1b00c2f44a575e5fd1e5d87a39b458e4603fccfb 100644 (file)
--- a/qemu-ga.c
+++ b/qemu-ga.c
@@ -439,7 +439,9 @@ static void become_daemon(const char *pidfile)
     return;
 
 fail:
-    unlink(pidfile);
+    if (pidfile) {
+        unlink(pidfile);
+    }
     g_critical("failed to daemonize");
     exit(EXIT_FAILURE);
 #endif