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:
seanc 2019-07-12 18:20:56 +00:00
parent 862e8ad26b
commit c1d34a7231

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);
}