[PATCH] ctdb: Coverity fix for CID 1291643
Michael Adam
obnox at samba.org
Tue Mar 31 10:34:22 MDT 2015
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
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
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150331/ac978342/attachment.pgp>
More information about the samba-technical
mailing list