Author: kib
Date: Mon Nov 13 10:45:31 2017
New Revision: 325759
URL: https://svnweb.freebsd.org/changeset/base/325759

Log:
  Do not leak PMC_PO_OWNS_LOGFILE on error.
  
  Note that PMCLOG_RESERVE_WITH_ERROR() macro contains goto error;
  statement and executed after the flag is set.
  
  Reported and tested by:       pho
  Sponsored by: The FreeBSD Foundation
  MFC after:    1 week

Modified:
  head/sys/dev/hwpmc/hwpmc_logging.c

Modified: head/sys/dev/hwpmc/hwpmc_logging.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_logging.c  Mon Nov 13 10:43:31 2017        
(r325758)
+++ head/sys/dev/hwpmc/hwpmc_logging.c  Mon Nov 13 10:45:31 2017        
(r325759)
@@ -683,6 +683,7 @@ pmclog_configure_log(struct pmc_mdep *md, struct pmc_o
                (void) fdrop(po->po_file, curthread);
        po->po_file  = NULL;    /* clear file and error state */
        po->po_error = 0;
+       po->po_flags &= ~PMC_PO_OWNS_LOGFILE;
 
        return (error);
 }
_______________________________________________
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