Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Nov 2017 10:45:31 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325759 - head/sys/dev/hwpmc
Message-ID:  <201711131045.vADAjV1u074339@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }



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