[DTrace-devel] [PATCH] cg: clear dnp->dn_tstring after freeing it

Kris Van Hees kris.van.hees at oracle.com
Sat Sep 16 00:20:48 UTC 2023


We were freeing the dn_tstring (if any) on a node wothout actually
setting dn_tstring to NULL to prevent any further use.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 libdtrace/dt_cg.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libdtrace/dt_cg.c b/libdtrace/dt_cg.c
index cfa253d0..372694d8 100644
--- a/libdtrace/dt_cg.c
+++ b/libdtrace/dt_cg.c
@@ -1262,8 +1262,10 @@ dt_cg_tstring_free(dt_pcb_t *pcb, dt_node_t *dnp)
 	case DT_NODE_OP2:
 	case DT_NODE_OP3:
 	case DT_NODE_DEXPR:
-		if (dnp->dn_tstring)
+		if (dnp->dn_tstring) {
 			dt_cg_tstring_xfree(pcb, dnp->dn_tstring->dn_value);
+			dnp->dn_tstring = NULL;
+		}
 	}
 }
 
-- 
2.40.1




More information about the DTrace-devel mailing list