Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Feb 2019 16:48:15 +0000 (UTC)
From:      "Rodney W. Grimes" <rgrimes@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r344160 - head/usr.sbin/bhyve
Message-ID:  <201902151648.x1FGmF41024971@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rgrimes
Date: Fri Feb 15 16:48:15 2019
New Revision: 344160
URL: https://svnweb.freebsd.org/changeset/base/344160

Log:
  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

Modified:
  head/usr.sbin/bhyve/pci_xhci.c

Modified: head/usr.sbin/bhyve/pci_xhci.c
==============================================================================
--- head/usr.sbin/bhyve/pci_xhci.c	Fri Feb 15 16:20:21 2019	(r344159)
+++ head/usr.sbin/bhyve/pci_xhci.c	Fri Feb 15 16:48:15 2019	(r344160)
@@ -2626,6 +2626,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;
@@ -2700,8 +2701,6 @@ pci_xhci_parse_opts(struct pci_xhci_softc *sc, char *o
 
 		sc->ndevices++;
 	}
-	if (uopt != NULL)
-		free(uopt);
 
 portsfinal:
 	sc->portregs = calloc(XHCI_MAX_DEVS, sizeof(struct pci_xhci_portregs));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201902151648.x1FGmF41024971>