Date: Tue, 23 Jul 2019 18:11:42 +0000 (UTC) From: Ed Maste <emaste@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r350251 - stable/12/usr.sbin/bhyve Message-ID: <201907231811.x6NIBgrH010952@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: emaste Date: Tue Jul 23 18:11:42 2019 New Revision: 350251 URL: https://svnweb.freebsd.org/changeset/base/350251 Log: bhyve: Fix resource leak when using strdup MFC r340044 (araujo): Fix resource leak when using strdup(3). MFC r344160 (rgrimes): 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. CID: 1357336 Reported by: Coverity Modified: stable/12/usr.sbin/bhyve/pci_xhci.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/pci_xhci.c ============================================================================== --- stable/12/usr.sbin/bhyve/pci_xhci.c Tue Jul 23 18:08:22 2019 (r350250) +++ stable/12/usr.sbin/bhyve/pci_xhci.c Tue Jul 23 18:11:42 2019 (r350251) @@ -2652,6 +2652,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; @@ -2755,6 +2756,7 @@ done: free(devices); } } + free(uopt); return (sc->ndevices); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201907231811.x6NIBgrH010952>