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

Eugene Loh eugene.loh at oracle.com
Mon Jun 30 22:07:39 UTC 2025


Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
but it'd be great if Nick could take a look, given that he reviewed the 
file earlier.
Out of curiosity, was there some case where the assertion failed? Could 
that be a test case?
(Minor nit:  I'd go for a sentence break after "allocate iterators.")

On 6/24/25 17:40, Kris Van Hees wrote:
> 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);
>   



More information about the DTrace-devel mailing list