mirror of https://github.com/xqemu/xqemu.git
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: 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>
This commit is contained in:
parent
5d27f9ce3d
commit
03ac10f166
|
@ -299,10 +299,12 @@ static bool ga_open_pidfile(const char *pidfile)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* keep pidfile open & locked forever */
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
unlink(pidfile);
|
unlink(pidfile);
|
||||||
|
close(pidfd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else /* _WIN32 */
|
#else /* _WIN32 */
|
||||||
|
|
Loading…
Reference in New Issue