[PATCH] ctdb: Coverity fix for CID 1291643

Rajesh Joseph rjoseph at redhat.com
Tue Mar 31 23:45:51 MDT 2015



----- Original Message -----
> From: "Michael Adam" <obnox at samba.org>
> To: "David Disseldorp" <ddiss at suse.de>
> Cc: "Samba Technical" <samba-technical at lists.samba.org>, "Rajesh Joseph" <rjoseph at redhat.com>
> Sent: Tuesday, March 31, 2015 10:04:22 PM
> Subject: Re: [PATCH] ctdb: Coverity fix for CID 1291643
> 
> Quite frankly I would like the first hunk
> squashed with Rajesh's patch.
> 
> This is also what your commit msg claims: to add the
> check for talloc_asprintf failure. :)
> 
> The last hunk: reviewed-by me

Thanks Dave and Michael for such a thorough review. Thanks
Dave for sending the patch to fix the 80 char limit and
another memory leak issue.

Actually I had fixed some more memory leaks as part of this patch,
but after Michael's comment I removed them. I will be sending
separate patches to address them.

Thanks & Regards,
Rajesh

> 
> Michael
> 
> On 2015-03-31 at 18:28 +0200, David Disseldorp wrote:
> > On Tue, 31 Mar 2015 18:14:32 +0200, Michael Adam wrote:
> > 
> > > On 2015-03-31 at 18:10 +0200, David Disseldorp wrote:
> > > > On Tue, 31 Mar 2015 11:43:53 -0400, Ira Cooper wrote:
> > > > 
> > > > > > That's a matter of taste, imho. And is 'most' enough?
> > > > > > I remember that we discussed this in the past, but
> > > > > > I don't remember the outcome...
> > > > > 
> > > > > 
> > > > > I've had patches bounced for Yoda...
> > > > > 
> > > > > And I'd agree on the second patch, because it is another CID.
> > > > 
> > > > Fair enough. Please see attached, as a patch atop Rajesh's original
> > > > change.
> > > 
> > > ENOPATCH :)
> > 
> > Oops. Once again.
> > 
> > Cheers, David
> 
> > From 054aa996fa8ce754aca6aa02040f5ddf215ac7db Mon Sep 17 00:00:00 2001
> > From: David Disseldorp <ddiss at samba.org>
> > Date: Tue, 31 Mar 2015 18:06:43 +0200
> > Subject: [PATCH] ctdb: check for talloc_asprintf() failure
> > 
> > Signed-off-by: David Disseldorp <ddiss at samba.org>
> > ---
> >  ctdb/tcp/tcp_connect.c | 12 +++++++++---
> >  1 file changed, 9 insertions(+), 3 deletions(-)
> > 
> > diff --git a/ctdb/tcp/tcp_connect.c b/ctdb/tcp/tcp_connect.c
> > index 78ad04b..b106f22 100644
> > --- a/ctdb/tcp/tcp_connect.c
> > +++ b/ctdb/tcp/tcp_connect.c
> > @@ -347,14 +347,20 @@ static int ctdb_tcp_listen_automatic(struct
> > ctdb_context *ctdb)
> >  	ctdb->address = talloc_memdup(ctdb,
> >  				      &ctdb->nodes[i]->address,
> >  				      sizeof(ctdb_sock_addr));
> > -	if (NULL == ctdb->address) {
> > -		DEBUG(DEBUG_ERR,("Out of memory for ctdb->address at %s\n",
> > __location__));
> > -		ctdb_set_error(ctdb, "Out of memory at %s:%d", __FILE__, __LINE__);
> > +	if (ctdb->address == NULL) {
> > +		ctdb_set_error(ctdb, "Out of memory at %s:%d",
> > +			       __FILE__, __LINE__);
> >  		goto failed;
> >  	}
> > +
> >  	ctdb->name = talloc_asprintf(ctdb, "%s:%u",
> >  				     ctdb_addr_to_str(ctdb->address),
> >  				     ctdb_addr_to_port(ctdb->address));
> > +	if (ctdb->name == NULL) {
> > +		ctdb_set_error(ctdb, "Out of memory at %s:%d",
> > +			       __FILE__, __LINE__);
> > +		goto failed;
> > +	}
> >  	DEBUG(DEBUG_INFO,("ctdb chose network address %s\n", ctdb->name));
> >  
> >  	if (listen(ctcp->listen_fd, 10) == -1) {
> > --
> > 2.1.4
> > 
> 
> 
> 
> 


More information about the samba-technical mailing list