Author: araujo
Date: Fri Nov  2 08:01:42 2018
New Revision: 340044
URL: https://svnweb.freebsd.org/changeset/base/340044

Log:
  Fix resource leak when using strdup(3).
  
  Reported by:  Coverity
  CID:          1357336
  Sponsored by: iXsystems Inc.

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

Modified: head/usr.sbin/bhyve/pci_xhci.c
==============================================================================
--- head/usr.sbin/bhyve/pci_xhci.c      Fri Nov  2 07:59:28 2018        
(r340043)
+++ head/usr.sbin/bhyve/pci_xhci.c      Fri Nov  2 08:01:42 2018        
(r340044)
@@ -2700,6 +2700,8 @@ 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));
@@ -2729,6 +2731,7 @@ done:
                        free(devices);
                }
        }
+       free(uopt);
        return (sc->ndevices);
 }
 
_______________________________________________
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