Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Aug 2018 06:38:02 +0000 (UTC)
From:      Marcelo Araujo <araujo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r337889 - head/usr.sbin/bhyve
Message-ID:  <201808160638.w7G6c2CS069755@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: araujo
Date: Thu Aug 16 06:38:01 2018
New Revision: 337889
URL: https://svnweb.freebsd.org/changeset/base/337889

Log:
  Fix a resource leak when using strdup(3) and also fix few style(9).
  
  Reported by:	Coverity
  CID:		1394929
  MFC after:	1 week
  Sponsored by:	iXsystems Inc.

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

Modified: head/usr.sbin/bhyve/pci_nvme.c
==============================================================================
--- head/usr.sbin/bhyve/pci_nvme.c	Thu Aug 16 06:35:44 2018	(r337888)
+++ head/usr.sbin/bhyve/pci_nvme.c	Thu Aug 16 06:38:01 2018	(r337889)
@@ -1746,6 +1746,8 @@ pci_nvme_parse_opts(struct pci_nvme_softc *sc, char *o
 
 		optidx++;
 	}
+	free(uopt);
+
 	if (sc->nvstore.ctx == NULL || sc->nvstore.size == 0) {
 		fprintf(stderr, "backing store not specified\n");
 		return (-1);
@@ -1756,9 +1758,7 @@ pci_nvme_parse_opts(struct pci_nvme_softc *sc, char *o
 		sc->nvstore.sectsz = blockif_sectsz(sc->nvstore.ctx);
 	for (sc->nvstore.sectsz_bits = 9;
 	     (1 << sc->nvstore.sectsz_bits) < sc->nvstore.sectsz;
-	     sc->nvstore.sectsz_bits++)
-		;
-
+	     sc->nvstore.sectsz_bits++);
 
 	if (sc->max_queues == 0) {
 		fprintf(stderr, "Invalid maxq option\n");



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