Commit 03ac10f1 authored by Markus Armbruster's avatar Markus Armbruster Committed by Michael Roth
Browse files

qemu-ga: Plug file descriptor leak on ga_open_pidfile() error path



Spotted by Coverity.  Also document why we keep it open on success.

Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
Reviewed-by: default avatarMichael Roth <mdroth@linux.vnet.ibm.com>
Reviewed-by: default avatarLuiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: default avatarMichael Roth <mdroth@linux.vnet.ibm.com>
parent 5d27f9ce
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -299,10 +299,12 @@ static bool ga_open_pidfile(const char *pidfile)
        goto fail;
    }

    /* keep pidfile open & locked forever */
    return true;

fail:
    unlink(pidfile);
    close(pidfd);
    return false;
}
#else /* _WIN32 */