Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: jeremie.galarneau@efficios.com (Jérémie Galarneau)
Subject: [lttng-dev] [PATCH lttng-tools] Fix: Free new_chunk on error
Date: Fri, 20 Sep 2019 17:34:26 -0400	[thread overview]
Message-ID: <20190920213426.GE20024@gmail.com> (raw)
In-Reply-To: <20190920144730.163268-1-jonathan.rajotte-julien@efficios.com>

Merged in master and stable-2.11.

On Fri, Sep 20, 2019 at 10:47:30AM -0400, Jonathan Rajotte wrote:
> Fixes coverity #1405775
> 
> Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
> ---
>  src/common/trace-chunk.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/common/trace-chunk.c b/src/common/trace-chunk.c
> index 6770bd982..bad993bea 100644
> --- a/src/common/trace-chunk.c
> +++ b/src/common/trace-chunk.c
> @@ -367,6 +367,8 @@ end:
>  	return new_chunk;
>  error_unlock:
>  	pthread_mutex_unlock(&source_chunk->lock);
> +	lttng_trace_chunk_fini(new_chunk);
> +	free(new_chunk);

Changed this to lttng_trace_chunk_put(), which will drop the only
existing reference to `new_chunk` and perform the equivalent
operations to what you proposed here.

Thanks!
J?r?mie

>  	return NULL;
>  }
>  
> -- 
> 2.17.1
> 


  reply	other threads:[~2019-09-20 21:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-20 14:47 Jonathan Rajotte
2019-09-20 21:34 ` Jérémie Galarneau [this message]
2019-09-20 21:37   ` Jonathan Rajotte-Julien
2019-09-20 21:42     ` Jonathan Rajotte-Julien

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=20190920213426.GE20024@gmail.com \
    --to=jeremie.galarneau@efficios.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