usr.sbin/bhyve: free resources when erroring out of pci_vtcon_sock_add()

Coverity CID:	1362880
Approved by:	markj, jhb
Differential Revision:	https://reviews.freebsd.org/D20916
This commit is contained in:
Sean Chittenden 2019-07-12 18:20:56 +00:00
parent cb84aeda17
commit ba1ca6d2e3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=349946

View file

@ -356,8 +356,11 @@ pci_vtcon_sock_add(struct pci_vtcon_softc *sc, const char *name,
if (fd != -1)
close(fd);
if (error != 0 && s != -1)
close(s);
if (error != 0) {
if (s != -1)
close(s);
free(sock);
}
return (error);
}