Skip to content

Commit

Permalink
qemu-ga: Plug file descriptor leak on ga_open_pidfile() error path
Browse files Browse the repository at this point in the history
Spotted by Coverity.  Also document why we keep it open on success.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
  • Loading branch information
Markus Armbruster authored and mdroth committed Jan 14, 2013
1 parent 5d27f9c commit 03ac10f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions qga/main.c
Expand Up @@ -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 */
Expand Down

0 comments on commit 03ac10f

Please sign in to comment.