svn commit: r350252 - stable/11/usr.sbin/bhyve

Ed Maste emaste at FreeBSD.org
Tue Jul 23 18:12:45 UTC 2019


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);
 }
 


More information about the svn-src-stable-11 mailing list