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@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
This commit is contained in:
parent
85cf19adc5
commit
11e67b92b5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=344160
@ -2626,6 +2626,7 @@ pci_xhci_parse_opts(struct pci_xhci_softc *sc, char *opts)
|
|||||||
char *uopt, *xopts, *config;
|
char *uopt, *xopts, *config;
|
||||||
int usb3_port, usb2_port, i;
|
int usb3_port, usb2_port, i;
|
||||||
|
|
||||||
|
uopt = NULL;
|
||||||
usb3_port = sc->usb3_port_start - 1;
|
usb3_port = sc->usb3_port_start - 1;
|
||||||
usb2_port = sc->usb2_port_start - 1;
|
usb2_port = sc->usb2_port_start - 1;
|
||||||
devices = NULL;
|
devices = NULL;
|
||||||
@ -2700,8 +2701,6 @@ pci_xhci_parse_opts(struct pci_xhci_softc *sc, char *opts)
|
|||||||
|
|
||||||
sc->ndevices++;
|
sc->ndevices++;
|
||||||
}
|
}
|
||||||
if (uopt != NULL)
|
|
||||||
free(uopt);
|
|
||||||
|
|
||||||
portsfinal:
|
portsfinal:
|
||||||
sc->portregs = calloc(XHCI_MAX_DEVS, sizeof(struct pci_xhci_portregs));
|
sc->portregs = calloc(XHCI_MAX_DEVS, sizeof(struct pci_xhci_portregs));
|
||||||
|
Loading…
Reference in New Issue
Block a user