[PATCH] Coverity fixes.

Jeremy Allison jra at samba.org
Fri Nov 9 23:18:31 UTC 2018


On Fri, Nov 09, 2018 at 03:09:28PM -0800, Jeremy Allison via samba-technical wrote:
> On Sat, Nov 10, 2018 at 12:02:12AM +0100, Stefan Metzmacher wrote:
> > Am 09.11.18 um 22:25 schrieb Jeremy Allison via samba-technical:
> > > Subject: [PATCH 1/2] s4: lib: messaging. Fix dead code. Coverity CID: 1437973
> > > 
> > > Signed-off-by: Jeremy Allison <jra at samba.org>
> > > ---
> > >  source4/lib/messaging/messaging.c | 4 ----
> > >  1 file changed, 4 deletions(-)
> > > 
> > > diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c
> > > index 935951f3fba..dada565d1be 100644
> > > --- a/source4/lib/messaging/messaging.c
> > > +++ b/source4/lib/messaging/messaging.c
> > > @@ -470,10 +470,6 @@ static void imessaging_post_handler(struct tevent_context *ev,
> > >  	imessaging_dgm_recv(ev, state->buf, state->buf_len, NULL, 0,
> > >  			    state->msg_ctx);
> > >  
> > > -	if (state == NULL) {
> > > -		return;
> > > -	}
> > > -
> > >  	state->busy_ref = NULL;
> > >  	TALLOC_FREE(state);
> > >  }
> > 
> > This is wrong! See a08ab2940051ae47ce71149087a24d060227ef19
> > 
> > imessaging_post_state_destructor() may set state = NULL,
> > via the state->busy_ref pointer.
> 
> Ah perfect, thanks ! I missed that :-).
> 
> Wow, that one is subtle...
> 
> Ralph (or metze), please cancel that autobuild.
> 
> Maybe a comment might help.

How about this instead ? Might stop another clueless chump
from stepping on this..
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-s4-lib-Coverity-CID-1437973-add-comment-explaining-w.patch
Type: text/x-diff
Size: 1064 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20181109/b3064127/0001-s4-lib-Coverity-CID-1437973-add-comment-explaining-w-0001.diff>


More information about the samba-technical mailing list