[DTrace-devel] [PATCH 1/4] Fix memory leak of dt_error DIFO

Kris Van Hees kris.van.hees at oracle.com
Tue Jun 8 20:37:16 PDT 2021


Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 libdtrace/dt_cc.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libdtrace/dt_cc.c b/libdtrace/dt_cc.c
index 86b06237..413c1c22 100644
--- a/libdtrace/dt_cc.c
+++ b/libdtrace/dt_cc.c
@@ -2141,10 +2141,15 @@ dt_construct(dtrace_hdl_t *dtp, dt_probe_t *prp, uint_t cflags, dt_ident_t *idp)
 	dp = dt_as(yypcb);
 
 	/*
-	 * If we were called with an identifier, assign the DIFO to it.
+	 * If we were called with an identifier, assign the DIFO to it.  We
+	 * also must ensure that the identifier is of the correct kind (and
+	 * has the proper configuration) - we do this by morphing it into
+	 * itself.
 	 */
-	if (idp != NULL)
+	if (idp != NULL) {
+		dt_ident_morph(idp, idp->di_kind, &dt_idops_difo, dtp);
 		dt_ident_set_data(idp, dp);
+	}
 
 out:
 	if (dtp->dt_cdefs_fd != -1 &&
-- 
2.31.1




More information about the DTrace-devel mailing list