Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Jun 2014 17:27:15 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r267875 - head/cddl/contrib/opensolaris/lib/libdtrace/common
Message-ID:  <201406251727.s5PHRFOV035007@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Wed Jun 25 17:27:15 2014
New Revision: 267875
URL: http://svnweb.freebsd.org/changeset/base/267875

Log:
  MFV	r258381:
  
  4251 libdtrace leaks open file handles
  
  Illumos commit:		93ed8d0d4b068b95d0bb50d57bb854df462a8485
  			(partial)
  Reference:
  https://www.illumos.org/issues/4251
  
  Discussed with:	Robert Mustacchi
  Obtained from:	Illumos
  MFC after:	1 week

Modified:
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c	Wed Jun 25 17:10:26 2014	(r267874)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c	Wed Jun 25 17:27:15 2014	(r267875)
@@ -2268,12 +2268,15 @@ dt_load_libs_dir(dtrace_hdl_t *dtp, cons
 			dt_dprintf("skipping library %s, already processed "
 			    "library with the same name: %s", dp->d_name,
 			    dld->dtld_library);
+			(void) fclose(fp);
 			continue;
 		}
 
 		dtp->dt_filetag = fname;
-		if (dt_lib_depend_add(dtp, &dtp->dt_lib_dep, fname) != 0)
+		if (dt_lib_depend_add(dtp, &dtp->dt_lib_dep, fname) != 0) {
+			(void) fclose(fp);
 			return (-1); /* preserve dt_errno */
+		}
 
 		rv = dt_compile(dtp, DT_CTX_DPROG,
 		    DTRACE_PROBESPEC_NAME, NULL,
@@ -2281,8 +2284,10 @@ dt_load_libs_dir(dtrace_hdl_t *dtp, cons
 
 		if (rv != NULL && dtp->dt_errno &&
 		    (dtp->dt_errno != EDT_COMPILER ||
-		    dtp->dt_errtag != dt_errtag(D_PRAGMA_DEPEND)))
+		    dtp->dt_errtag != dt_errtag(D_PRAGMA_DEPEND))) {
+			(void) fclose(fp);
 			return (-1); /* preserve dt_errno */
+		}
 
 		if (dtp->dt_errno)
 			dt_dprintf("error parsing library %s: %s\n",



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