Date: Tue, 23 Jul 2019 18:12:45 +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-11@freebsd.org Subject: svn commit: r350252 - stable/11/usr.sbin/bhyve Message-ID: <201907231812.x6NICjmE012408@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: emaste Date: Tue Jul 23 18:12:44 2019 New Revision: 350252 URL: https://svnweb.freebsd.org/changeset/base/350252 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/11/usr.sbin/bhyve/pci_xhci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyve/pci_xhci.c ============================================================================== --- stable/11/usr.sbin/bhyve/pci_xhci.c Tue Jul 23 18:11:42 2019 (r350251) +++ stable/11/usr.sbin/bhyve/pci_xhci.c Tue Jul 23 18:12:44 2019 (r350252) @@ -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?201907231812.x6NICjmE012408>