diff options
author | pfg <pfg@FreeBSD.org> | 2014-08-16 00:52:13 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2014-08-16 00:52:13 +0000 |
commit | 5b8c39f44b953ecbb0160f46a7b3e4ed1e5453e0 (patch) | |
tree | 98f577aa167cfd6be0539fcee95c164c4ed2669a /cddl/contrib/opensolaris/lib/libdtrace | |
parent | dc9f54ca59ea1a35306a07880d431cd1cf644a79 (diff) | |
download | FreeBSD-src-5b8c39f44b953ecbb0160f46a7b3e4ed1e5453e0.zip FreeBSD-src-5b8c39f44b953ecbb0160f46a7b3e4ed1e5453e0.tar.gz |
MFC r267875:
4251 libdtrace leaks open file handles
Illumos commit: 93ed8d0d4b068b95d0bb50d57bb854df462a8485
(partial)
Reference:
https://www.illumos.org/issues/4251
Discussed with: Robert Mustacchi
Obtained from: Illumos
Diffstat (limited to 'cddl/contrib/opensolaris/lib/libdtrace')
-rw-r--r-- | cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c index a19152e..35b8f02 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c @@ -2289,12 +2289,15 @@ dt_load_libs_dir(dtrace_hdl_t *dtp, const char *path) 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, @@ -2302,8 +2305,10 @@ dt_load_libs_dir(dtrace_hdl_t *dtp, const char *path) 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", |