check for talloc_asprintf() failure
authorDavid Disseldorp <ddiss@samba.org>
Tue, 31 Mar 2015 16:06:43 +0000 (18:06 +0200)
committerMartin Schwenke <martin@meltin.net>
Wed, 24 Feb 2016 06:11:31 +0000 (17:11 +1100)
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Wed Apr  1 15:36:03 CEST 2015 on sn-devel-104

(Imported from commit 12309f8bfb70878bec5fcec4681eb4e463e07357)

tcp/tcp_connect.c

index 8032662a29b66688622043a56d7bca608c6f7b32..a7c180262916cce903098404024d2740b3ff7e64 100644 (file)
@@ -395,6 +395,11 @@ static int ctdb_tcp_listen_automatic(struct ctdb_context *ctdb)
        ctdb->name = talloc_asprintf(ctdb, "%s:%u", 
                                     ctdb->address.address, 
                                     ctdb->address.port);
+       if (ctdb->name == NULL) {
+               ctdb_set_error(ctdb, "Out of memory at %s:%d",
+                              __FILE__, __LINE__);
+               goto failed;
+       }
        ctdb->pnn = ctdb->nodes[i]->pnn;
        DEBUG(DEBUG_INFO,("ctdb chose network address %s:%u pnn %u\n", 
                 ctdb->address.address,