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");
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to