qemu: Don't check pidfile in qemuPasstStart

The pidfile is guaranteed to be non-NULL (thanks to glib allocation
functions) and it's dereferenced two lines above anyway.

Reported by coverity:

    /src/qemu/qemu_passt.c: 278 in qemuPasstStart()
    272         return 0;
    273
    274      error:
    275         ignore_value(virPidFileReadPathIfLocked(pidfile, &pid));
    276         if (pid != -1)
    277             virProcessKillPainfully(pid, true);
    >>>     CID 404360:  Null pointer dereferences  (REVERSE_INULL)
    >>>     Null-checking "pidfile" suggests that it may be null, but it
    >>>     has already been dereferenced on all paths leading to the check.
    278         if (pidfile)
    279             unlink(pidfile);
    280
    281         return -1;

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Jiri Denemark 2023-01-11 09:54:59 +01:00
parent a82d74dd75
commit 12d194404c

View File

@ -275,8 +275,7 @@ qemuPasstStart(virDomainObj *vm,
ignore_value(virPidFileReadPathIfLocked(pidfile, &pid));
if (pid != -1)
virProcessKillPainfully(pid, true);
if (pidfile)
unlink(pidfile);
unlink(pidfile);
return -1;
}