2
0
Эх сурвалжийг харах

qemu-ga: Fix null pointer passed to unlink in failure branch

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>
Stefan Weil 13 жил өмнө
parent
commit
cccb5446a6
1 өөрчлөгдсөн 3 нэмэгдсэн , 1 устгасан
  1. 3 1
      qemu-ga.c

+ 3 - 1
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