svn commit: r344160 - head/usr.sbin/bhyve
Rodney W. Grimes
rgrimes at FreeBSD.org
Fri Feb 15 16:48:16 UTC 2019
Author: rgrimes
Date: Fri Feb 15 16:48:15 2019
New Revision: 344160
URL: https://svnweb.freebsd.org/changeset/base/344160
Log:
In r340044 an attempt to quiet coverity warning cid 1357336
was incorrectly implemented leading to a possible double free.
It is possible for both the conditional free,
and the unconditional free added in r340044 to be done,
fix that by initializing uopt to NULL,
removing the conditional free,
and only using the unconditional free at the end.
Reported by: Patrick Mooney (patrick.mooney at joyent.com)
Reviewed by: jhb (maintainer), Patrick Mooney (joyent/illumos)
Approved by: bde (mentor)
CID: 1357336
MFC after: 3 days
MFC with: 340044
Differential Revision: https://reviews.freebsd.org/D19202
Modified:
head/usr.sbin/bhyve/pci_xhci.c
Modified: head/usr.sbin/bhyve/pci_xhci.c
==============================================================================
--- head/usr.sbin/bhyve/pci_xhci.c Fri Feb 15 16:20:21 2019 (r344159)
+++ head/usr.sbin/bhyve/pci_xhci.c Fri Feb 15 16:48:15 2019 (r344160)
@@ -2626,6 +2626,7 @@ pci_xhci_parse_opts(struct pci_xhci_softc *sc, char *o
char *uopt, *xopts, *config;
int usb3_port, usb2_port, i;
+ uopt = NULL;
usb3_port = sc->usb3_port_start - 1;
usb2_port = sc->usb2_port_start - 1;
devices = NULL;
@@ -2700,8 +2701,6 @@ pci_xhci_parse_opts(struct pci_xhci_softc *sc, char *o
sc->ndevices++;
}
- if (uopt != NULL)
- free(uopt);
portsfinal:
sc->portregs = calloc(XHCI_MAX_DEVS, sizeof(struct pci_xhci_portregs));
More information about the svn-src-all
mailing list