From mboxrd@z Thu Jan 1 00:00:00 1970 From: jeremie.galarneau@efficios.com (=?iso-8859-1?Q?J=E9r=E9mie?= Galarneau) Date: Fri, 20 Sep 2019 17:34:26 -0400 Subject: [lttng-dev] [PATCH lttng-tools] Fix: Free new_chunk on error In-Reply-To: <20190920144730.163268-1-jonathan.rajotte-julien@efficios.com> References: <20190920144730.163268-1-jonathan.rajotte-julien@efficios.com> Message-ID: <20190920213426.GE20024@gmail.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 > --- > 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 >