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

Nick Alcock nick.alcock at oracle.com
Tue Jul 15 14:14:34 UTC 2025


On 24 Jun 2025, Kris Van Hees said:

> 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);

That seems... better than we had before. I was seeing double-frees all
over the place with what you previously committed: I'll have to see if
this helps.

-- 
NULL && (void)



More information about the DTrace-devel mailing list