[DTrace-devel] [PATCH 3/3] usdt parser: make sure prbmap is cleaned up in case of error

Kris Van Hees kris.van.hees at oracle.com
Tue Jun 24 21:40:27 UTC 2025


Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 libcommon/usdt_parser_notes.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/libcommon/usdt_parser_notes.c b/libcommon/usdt_parser_notes.c
index d3d744fb..c98c9fb0 100644
--- a/libcommon/usdt_parser_notes.c
+++ b/libcommon/usdt_parser_notes.c
@@ -829,15 +829,16 @@ usdt_parse_notes(int out, dof_helper_t *dhp, usdt_data_t *data)
 	goto out;
 
 err:
-	rc = -1;
-
-out:
 	/*
-	 * All tracepoint probes in prbmap should have been removed during
-	 * proessing.
+	 * In case of an error, we don't know whether we can allocate iterators
+	 * so we have few options to provide cleanup.  Since cleanup is all we
+	 * do now, we plug the probe cleanup function into the ops for prbmap,
+	 * and let the hashtable destroy function take care of all cleanup.
 	 */
-	assert(dt_htab_entries(prbmap) == 0);
+	prb_htab_ops.del = (htab_del_fn)prb_del_probe;
+	rc = -1;
 
+out:
 	dt_htab_destroy(prvmap);
 	dt_htab_destroy(prbmap);
 
-- 
2.43.5




More information about the DTrace-devel mailing list