Skip to content

Commit

Permalink
Fix resource leak when using strdup(3).
Browse files Browse the repository at this point in the history
Reported by:	Coverity
CID:		1357336
Sponsored by:	iXsystems Inc.
  • Loading branch information
araujobsd committed Nov 2, 2018
1 parent 6c8dae3 commit 93670f7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions usr.sbin/bhyve/pci_xhci.c
Original file line number Diff line number Diff line change
Expand Up @@ -2700,6 +2700,8 @@ pci_xhci_parse_opts(struct pci_xhci_softc *sc, char *opts)

sc->ndevices++;
}
if (uopt != NULL)
free(uopt);

portsfinal:
sc->portregs = calloc(XHCI_MAX_DEVS, sizeof(struct pci_xhci_portregs));
Expand Down Expand Up @@ -2729,6 +2731,7 @@ pci_xhci_parse_opts(struct pci_xhci_softc *sc, char *opts)
free(devices);
}
}
free(uopt);
return (sc->ndevices);
}

Expand Down

0 comments on commit 93670f7

Please sign in to comment.