linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Yordan Karadzhov <y.karadz@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [RFC PATCH] libtracefs: New APIs for getting the raw format of synth event
Date: Wed, 8 Dec 2021 18:24:45 -0500	[thread overview]
Message-ID: <20211208182445.26419168@gandalf.local.home> (raw)
In-Reply-To: <85fef0bf-879d-06a9-f2fd-de2d0171fb1d@gmail.com>

On Wed, 8 Dec 2021 15:31:26 +0200
Yordan Karadzhov <y.karadz@gmail.com> wrote:

> >>    remove_start_hist:
> >> -	remove_hist(synth->instance, synth->start_event, start_hist);
> >> +	remove_hist(synth->instance, synth->start_event, synth->start_hist);
> >>    remove_synthetic:
> >> -	free(end_hist);
> >> -	free(start_hist);
> >>   	tracefs_dynevent_destroy(synth->dyn_event, false);  
> > I just realized that on error, we do not free the synthetic event
> > descriptor. So there is a memory leak.
> >   
> 
> Do we need to free the synthetic event here?
> 
> The event gets allocated with 'tracefs_synth_alloc()' and the user is responsible for calling 'tracefs_synth_free()' in 
> order to free the memory.
> The fact that 'tracefs_synth_create()' may fail doesn't change this.

Ah, you're correct. I was thinking that we allocated it here, but forgot we
separated create and alloc.

-- Steve

      reply	other threads:[~2021-12-08 23:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06 15:13 [RFC PATCH] libtracefs: New APIs for getting the raw format of synth event Yordan Karadzhov (VMware)
2021-12-07 22:13 ` Steven Rostedt
2021-12-08 13:31   ` Yordan Karadzhov
2021-12-08 23:24     ` Steven Rostedt [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=20211208182445.26419168@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=y.karadz@gmail.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;
as well as URLs for NNTP newsgroup(s).