lttng-dev.lists.lttng.org archive mirror
 help / color / mirror / Atom feed
* [PATCH lttng-tools] Fix: Free new_chunk on error
@ 2019-09-20 14:47 Jonathan Rajotte
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Rajotte @ 2019-09-20 14:47 UTC (permalink / raw)
  To: lttng-dev; +Cc: jgalar

Fixes coverity #1405775

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@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);
 	return NULL;
 }
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH lttng-tools] Fix: Free new_chunk on error
       [not found]   ` <20190920213714.GB187569@joraj-alpa>
@ 2019-09-20 21:42     ` Jonathan Rajotte-Julien
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Rajotte-Julien @ 2019-09-20 21:42 UTC (permalink / raw)
  To: Jérémie Galarneau; +Cc: lttng-dev, jgalar

> 
> Okai, I saw a similar pattern somewhere in the file. Might want to check if the
> same can be applied there.

Nevermind it is in the release code.

> 
> > 
> > Thanks!
> > Jérémie
> > 
> > >  	return NULL;
> > >  }
> > >  
> > > -- 
> > > 2.17.1
> > > 
> 
> -- 
> Jonathan Rajotte-Julien
> EfficiOS
> _______________________________________________
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Jonathan Rajotte-Julien
EfficiOS

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH lttng-tools] Fix: Free new_chunk on error
       [not found] ` <20190920213426.GE20024@gmail.com>
@ 2019-09-20 21:37   ` Jonathan Rajotte-Julien
       [not found]   ` <20190920213714.GB187569@joraj-alpa>
  1 sibling, 0 replies; 4+ messages in thread
From: Jonathan Rajotte-Julien @ 2019-09-20 21:37 UTC (permalink / raw)
  To: Jérémie Galarneau; +Cc: lttng-dev, jgalar

On Fri, Sep 20, 2019 at 05:34:26PM -0400, Jérémie Galarneau wrote:
> 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@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.

Okai, I saw a similar pattern somewhere in the file. Might want to check if the
same can be applied there.

> 
> Thanks!
> Jérémie
> 
> >  	return NULL;
> >  }
> >  
> > -- 
> > 2.17.1
> > 

-- 
Jonathan Rajotte-Julien
EfficiOS

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH lttng-tools] Fix: Free new_chunk on error
       [not found] <20190920144730.163268-1-jonathan.rajotte-julien@efficios.com>
@ 2019-09-20 21:34 ` Jérémie Galarneau
       [not found] ` <20190920213426.GE20024@gmail.com>
  1 sibling, 0 replies; 4+ messages in thread
From: Jérémie Galarneau @ 2019-09-20 21:34 UTC (permalink / raw)
  To: Jonathan Rajotte; +Cc: lttng-dev, jgalar

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@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
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-09-20 21:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-20 14:47 [PATCH lttng-tools] Fix: Free new_chunk on error Jonathan Rajotte
     [not found] <20190920144730.163268-1-jonathan.rajotte-julien@efficios.com>
2019-09-20 21:34 ` Jérémie Galarneau
     [not found] ` <20190920213426.GE20024@gmail.com>
2019-09-20 21:37   ` Jonathan Rajotte-Julien
     [not found]   ` <20190920213714.GB187569@joraj-alpa>
2019-09-20 21:42     ` Jonathan Rajotte-Julien

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).