public inbox for dtrace@lists.linux.dev
 help / color / mirror / Atom feed
From: Nick Alcock <nick.alcock@oracle.com>
To: Kris Van Hees <kris.van.hees@oracle.com>
Cc: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: Re: [PATCH 3/3] usdt parser: make sure prbmap is cleaned up in case of error
Date: Tue, 15 Jul 2025 15:14:34 +0100	[thread overview]
Message-ID: <87tt3dsfqt.fsf@esperi.org.uk> (raw)
In-Reply-To: <SJ0PR10MB5672A2F843CDC28C7266DB9EC278A@SJ0PR10MB5672.namprd10.prod.outlook.com> (Kris Van Hees's message of "Tue, 24 Jun 2025 17:40:27 -0400")

On 24 Jun 2025, Kris Van Hees said:

> Signed-off-by: Kris Van Hees <kris.van.hees@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)

      parent reply	other threads:[~2025-07-15 14:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-24 21:40 [PATCH 3/3] usdt parser: make sure prbmap is cleaned up in case of error Kris Van Hees
2025-06-30 22:07 ` Eugene Loh
2025-06-30 23:09   ` Kris Van Hees
2025-07-15 14:14 ` Nick Alcock [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tt3dsfqt.fsf@esperi.org.uk \
    --to=nick.alcock@oracle.com \
    --cc=dtrace-devel@oss.oracle.com \
    --cc=dtrace@lists.linux.dev \
    --cc=kris.van.hees@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox