[SCM] CTDB repository - branch master updated - ctdb-1.0.82-12-gd623ea7

Ronnie Sahlberg sahlberg at samba.org
Thu May 21 02:21:36 GMT 2009


The branch, master has been updated
       via  d623ea7c04daa6349b42d50862843c9f86115488 (commit)
       via  3aee5ee1deb4a19be3bd3a4ce3abbe09de763344 (commit)
       via  0e84ea23d1d998d4d4ac7d8a858b3d8294f056cb (commit)
       via  4f86c991812c2d0bddbe3de9a9906cf5df118cd4 (commit)
       via  fa5afee8e9a8fba6017bc58f87bc040de7206e63 (commit)
       via  1d833163b57853b84f098dffdb3c5f50164fcc73 (commit)
      from  92b5580c38c23b99c1692708540983b0c0fcd6cf (commit)

http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit d623ea7c04daa6349b42d50862843c9f86115488
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu May 21 11:49:16 2009 +1000

    Whitespace changes and using the CTDB_NO_MEMORY() macro changes to
    the previous patch.

commit 3aee5ee1deb4a19be3bd3a4ce3abbe09de763344
Author: Sumit Bose <sbose at redhat.com>
Date:   Wed May 20 12:08:13 2009 +0200

    add missing checks on so far ignored return values
    
    Most of these were found during a review by Jim Meyering <meyering at redhat.com>

commit 0e84ea23d1d998d4d4ac7d8a858b3d8294f056cb
Author: Sumit Bose <sbose at redhat.com>
Date:   Wed May 20 12:02:27 2009 +0200

    structure member node_list_file is not used anywhere

commit 4f86c991812c2d0bddbe3de9a9906cf5df118cd4
Author: Sumit Bose <sbose at redhat.com>
Date:   Wed May 20 11:47:34 2009 +0200

    structure member logfile is not used anywhere

commit fa5afee8e9a8fba6017bc58f87bc040de7206e63
Author: Sumit Bose <sbose at redhat.com>
Date:   Wed May 20 09:17:01 2009 +0200

    fix a configure warning while checking for netfilter.h

commit 1d833163b57853b84f098dffdb3c5f50164fcc73
Author: Sumit Bose <sbose at redhat.com>
Date:   Wed May 20 08:59:00 2009 +0200

    added a missing dependency

-----------------------------------------------------------------------

Summary of changes:
 Makefile.in                 |    2 +-
 client/ctdb_client.c        |   15 +++++++++++++-
 common/cmdline.c            |    7 +++++-
 common/ctdb_util.c          |    2 +
 configure.ac                |    2 +-
 ib/ibw_ctdb.c               |    2 +
 ib/ibw_ctdb_init.c          |    4 +++
 ib/ibwrapper.c              |    8 +++++-
 ib/ibwrapper_test.c         |    2 +
 include/ctdb_private.h      |    2 -
 lib/util/db_wrap.c          |    4 +++
 lib/util/debug.c            |   10 +++++++-
 server/ctdb_daemon.c        |    4 +++
 server/ctdb_logging.c       |   46 ++++++++++++++++++++++++++++++++++--------
 server/ctdb_server.c        |    7 +++--
 server/ctdb_takeover.c      |    2 +
 server/eventscript.c        |    6 ++++-
 tests/src/ctdb_persistent.c |   10 ++++++++-
 tools/ctdb.c                |   32 +++++++++++++++++++++++------
 utils/ping_pong/ping_pong.c |   17 ++++++++++++++-
 20 files changed, 151 insertions(+), 33 deletions(-)


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index 1288317..7297db6 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -112,7 +112,7 @@ bin/ctdb: $(CTDB_CLIENT_OBJ) tools/ctdb.o tools/ctdb_vacuum.o
 	@echo Linking $@
 	@$(CC) $(CFLAGS) -o $@ tools/ctdb.o tools/ctdb_vacuum.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS)
 
-bin/smnotify: utils/smnotify/gen_xdr.o utils/smnotify/gen_smnotify.o utils/smnotify/smnotify.o 
+bin/smnotify: utils/smnotify/gen_xdr.o utils/smnotify/gen_smnotify.o utils/smnotify/smnotify.o $(POPT_OBJ)
 	@echo Linking $@
 	@$(CC) $(CFLAGS) -o $@ utils/smnotify/smnotify.o utils/smnotify/gen_xdr.o utils/smnotify/gen_smnotify.o $(POPT_OBJ) $(LIB_FLAGS)
 
diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index df9fa06..9d7ef84 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -2336,6 +2336,7 @@ int ctdb_ctrl_get_public_ipsv4(struct ctdb_context *ctdb,
 	len = offsetof(struct ctdb_all_public_ips, ips) +
 		ipsv4->num*sizeof(struct ctdb_public_ip);
 	*ips = talloc_zero_size(mem_ctx, len);
+	CTDB_NO_MEMORY(ctdb, *ips);
 	(*ips)->num = ipsv4->num;
 	for (i=0; i<ipsv4->num; i++) {
 		(*ips)->ips[i].pnn     = ipsv4->ips[i].pnn;
@@ -2708,14 +2709,24 @@ int ctdb_ctrl_get_server_id_list(struct ctdb_context *ctdb,
 */
 struct ctdb_context *ctdb_init(struct event_context *ev)
 {
+	int ret;
 	struct ctdb_context *ctdb;
 
 	ctdb = talloc_zero(ev, struct ctdb_context);
+	if (ctdb == NULL) {
+		DEBUG(DEBUG_ERR,(__location__ " talloc_zero failed.\n"));
+		return NULL;
+	}
 	ctdb->ev  = ev;
 	ctdb->idr = idr_init(ctdb);
 	CTDB_NO_MEMORY_NULL(ctdb, ctdb->idr);
 
-	ctdb_set_socketname(ctdb, CTDB_PATH);
+	ret = ctdb_set_socketname(ctdb, CTDB_PATH);
+	if (ret != 0) {
+		DEBUG(DEBUG_ERR,(__location__ " ctdb_set_socketname failed.\n"));
+		talloc_free(ctdb);
+		return NULL;
+	}
 
 	return ctdb;
 }
@@ -2735,6 +2746,8 @@ void ctdb_set_flags(struct ctdb_context *ctdb, unsigned flags)
 int ctdb_set_socketname(struct ctdb_context *ctdb, const char *socketname)
 {
 	ctdb->daemon.name = talloc_strdup(ctdb, socketname);
+	CTDB_NO_MEMORY(ctdb, ctdb->daemon.name);
+
 	return 0;
 }
 
diff --git a/common/cmdline.c b/common/cmdline.c
index 2136bf6..3acbf96 100644
--- a/common/cmdline.c
+++ b/common/cmdline.c
@@ -117,7 +117,12 @@ struct ctdb_context *ctdb_cmdline_client(struct event_context *ev)
 	/* tell ctdb the socket address */
 	socket_name = getenv("CTDB_SOCKET");
 	if (socket_name != NULL) {
-		ctdb_set_socketname(ctdb, socket_name);
+		ret = ctdb_set_socketname(ctdb, socket_name);
+		if (ret == -1) {
+			printf("ctdb_set_socketname failed - %s\n",
+						    ctdb_errstr(ctdb));
+			exit(1);
+		}
 	}
 
 	if (ctdb_cmdline.socketname != NULL) {
diff --git a/common/ctdb_util.c b/common/ctdb_util.c
index 3604cc8..d64f515 100644
--- a/common/ctdb_util.c
+++ b/common/ctdb_util.c
@@ -73,6 +73,8 @@ int ctdb_parse_address(struct ctdb_context *ctdb,
 	endservent();
 	
 	address->address = talloc_strdup(mem_ctx, str);
+	CTDB_NO_MEMORY(ctdb, address->address);
+
 	if (se == NULL) {
 		address->port = CTDB_PORT;
 	} else {
diff --git a/configure.ac b/configure.ac
index 416349d..fd75717 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,7 +69,7 @@ m4_include(libtdb.m4)
 m4_include(libevents.m4)
 m4_include(ib/config.m4)
 
-AC_CHECK_HEADERS(libipq.h linux/netfilter.h)
+AC_CHECK_HEADERS([libipq.h linux/netfilter.h], [], [], [#include <netinet/in.h>])
 
 IPQ_LIBS=""
 if test x"$ac_cv_header_libipq_h" = x"yes"; then
diff --git a/ib/ibw_ctdb.c b/ib/ibw_ctdb.c
index fd577ff..78d960a 100644
--- a/ib/ibw_ctdb.c
+++ b/ib/ibw_ctdb.c
@@ -166,6 +166,8 @@ int ctdb_ibw_receive_handler(struct ibw_conn *conn, void *buf, int n)
 	 * and being reused for next receive
 	 * noticed that HL requires talloc-ed memory to be stolen */
 	buf2 = talloc_zero_size(conn, n);
+	CTDB_NO_MEMORY(ctdb, buf2);
+
 	memcpy(buf2, buf, n);
 
 	ctdb->upcalls->recv_pkt(ctdb, (uint8_t *)buf2, (uint32_t)n);
diff --git a/ib/ibw_ctdb_init.c b/ib/ibw_ctdb_init.c
index 2f4fbfe..170ce30 100644
--- a/ib/ibw_ctdb_init.c
+++ b/ib/ibw_ctdb_init.c
@@ -164,7 +164,11 @@ static int ctdb_ibw_queue_pkt(struct ctdb_node *node, uint8_t *data, uint32_t le
 		rc = ctdb_ibw_send_pkt(cn->conn, data, length);
 	} else {
 		struct ctdb_ibw_msg *p = talloc_zero(cn, struct ctdb_ibw_msg);
+		CTDB_NO_MEMORY(node->ctdb, p);
+
 		p->data = talloc_memdup(p, data, length);
+		CTDB_NO_MEMORY(node->ctdb, p->data);
+
 		p->length = length;
 
 		DLIST_ADD_AFTER(cn->queue, p, cn->queue_last);
diff --git a/ib/ibwrapper.c b/ib/ibwrapper.c
index 5a166e5..f6e7168 100644
--- a/ib/ibwrapper.c
+++ b/ib/ibwrapper.c
@@ -852,7 +852,9 @@ static int ibw_wc_recv(struct ibw_conn *conn, struct ibv_wc *wc)
 			}
 
 			if (part->to_read==0) {
-				pctx->receive_func(conn, part->buf, part->len);
+				if (pctx->receive_func(conn, part->buf, part->len) != 0) {
+					goto error;
+				}
 				part->len = 0; /* tells not having partial data (any more) */
 				if (ibw_wc_mem_threshold(pconn, part, pctx->opts.recv_threshold))
 					goto error;
@@ -867,7 +869,9 @@ static int ibw_wc_recv(struct ibw_conn *conn, struct ibv_wc *wc)
 
 				/* mostly awaited case: */
 				if (msglen<=remain) {
-					pctx->receive_func(conn, p, msglen);
+					if (pctx->receive_func(conn, p, msglen) != 0) {
+						goto error;
+					}
 					p += msglen;
 					remain -= msglen;
 				} else {
diff --git a/ib/ibwrapper_test.c b/ib/ibwrapper_test.c
index cbd4f43..b9c80ae 100644
--- a/ib/ibwrapper_test.c
+++ b/ib/ibwrapper_test.c
@@ -486,6 +486,7 @@ int ibwtest_getdests(struct ibwtest_ctx *tcx, char op)
 	char	*tmp;
 
 	tmp = talloc_strdup(tcx, optarg);
+	if (tmp == NULL) return -1;
 	/* hack to reuse the above ibw_initattr parser */
 	if (ibwtest_parse_attrs(tcx, tmp, &attrs, &tcx->naddrs, op))
 		return -1;
@@ -567,6 +568,7 @@ int main(int argc, char *argv[])
 			break;
 		case 'o':
 			tcx->opts = talloc_strdup(tcx, optarg);
+			if (tcx->opts) goto cleanup;
 			if (ibwtest_parse_attrs(tcx, tcx->opts, &tcx->attrs,
 				&tcx->nattrs, op))
 				goto cleanup;
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 5ecf8a6..ff007a8 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -375,8 +375,6 @@ struct ctdb_context {
 	const char *db_directory;
 	const char *db_directory_persistent;
 	const char *transport;
-	const char *logfile;
-	char *node_list_file;
 	char *recovery_lock_file;
 	int recovery_lock_fd;
 	uint32_t pnn; /* our own pnn */
diff --git a/lib/util/db_wrap.c b/lib/util/db_wrap.c
index f4e89cf..7f5240e 100644
--- a/lib/util/db_wrap.c
+++ b/lib/util/db_wrap.c
@@ -82,6 +82,10 @@ struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx,
 	}
 
 	w->name = talloc_strdup(w, name);
+	if (w->name == NULL) {
+		talloc_free(w);
+		return NULL;
+	}
 
 	w->tdb = tdb_open_ex(name, hash_size, tdb_flags, 
 			     open_flags, mode, &log_ctx, NULL);
diff --git a/lib/util/debug.c b/lib/util/debug.c
index 341a4a1..2390f4c 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -28,8 +28,14 @@ static void _do_debug_v(const char *format, va_list ap)
 	char *s = NULL;
 	struct tm *tm;
 	char tbuf[100];
-
-	vasprintf(&s, format, ap);
+	int ret;
+
+	ret = vasprintf(&s, format, ap);
+	if (ret == -1) {
+		fprintf(stderr, "vasprintf failed in _do_debug_v, cannot print debug message.\n");
+		fflush(stderr);
+		return;
+	}
 
 	t = timeval_current();
 	tm = localtime(&t.tv_sec);
diff --git a/server/ctdb_daemon.c b/server/ctdb_daemon.c
index 8a3f564..957f5d8 100644
--- a/server/ctdb_daemon.c
+++ b/server/ctdb_daemon.c
@@ -690,6 +690,10 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork)
 
 	/* ensure the socket is deleted on exit of the daemon */
 	domain_socket_name = talloc_strdup(talloc_autofree_context(), ctdb->daemon.name);
+	if (domain_socket_name == NULL) {
+		DEBUG(DEBUG_ALERT,(__location__ " talloc_strdup failed.\n"));
+		exit(12);
+	}
 	talloc_set_destructor(domain_socket_name, unlink_destructor);	
 
 	ctdb->ev = event_context_init(NULL);
diff --git a/server/ctdb_logging.c b/server/ctdb_logging.c
index 45a9f74..bae27cf 100644
--- a/server/ctdb_logging.c
+++ b/server/ctdb_logging.c
@@ -25,7 +25,6 @@
 #include "system/filesys.h"
 
 struct ctdb_log_state {
-	char *logfile;
 	int fd, pfd;
 	char buf[1024];
 	uint16_t buf_used;
@@ -81,20 +80,32 @@ static void ctdb_logfile_log(const char *format, va_list ap)
 	struct tm *tm;
 	char tbuf[100];
 	char *s2 = NULL;
+	int ret;
 
-	vasprintf(&s, format, ap);
+	ret = vasprintf(&s, format, ap);
+	if (ret == -1) {
+		const char *errstr = "vasprintf failed\n";
+
+		write(log_state->fd, errstr, strlen(errstr));
+		return;
+	}
 
 	t = timeval_current();
 	tm = localtime(&t.tv_sec);
 
 	strftime(tbuf,sizeof(tbuf)-1,"%Y/%m/%d %H:%M:%S", tm);
 
-	asprintf(&s2, "%s.%06u [%5u]: %s", 
+	ret = asprintf(&s2, "%s.%06u [%5u]: %s",
 		 tbuf, (unsigned)t.tv_usec, (unsigned)getpid(), s);
 	free(s);
+	if (ret == -1) {
+		const char *errstr = "asprintf failed\n";
+		write(log_state->fd, errstr, strlen(errstr));
+		return;
+	}
 	if (s2) {
 		write(log_state->fd, s2, strlen(s2));
-		free(s2);	
+		free(s2);
 	}
 }
 
@@ -103,7 +114,12 @@ static void ctdb_logfile_log(const char *format, va_list ap)
 */
 int ctdb_set_logfile(struct ctdb_context *ctdb, const char *logfile, bool use_syslog)
 {
+	int ret;
 	ctdb->log = talloc_zero(ctdb, struct ctdb_log_state);
+	if (ctdb->log == NULL) {
+		printf("talloc_zero failed\n");
+		abort();
+	}
 
 	log_state = ctdb->log;
 
@@ -114,14 +130,17 @@ int ctdb_set_logfile(struct ctdb_context *ctdb, const char *logfile, bool use_sy
 		do_debug_v = ctdb_logfile_log;
 		ctdb->log->fd = 1;
 		/* also catch stderr of subcommands to stdout */
-		dup2(1, 2);
+		ret = dup2(1, 2);
+		if (ret == -1) {
+			printf("dup2 failed: %s\n", strerror(errno));
+			abort();
+		}
 	} else {
 		do_debug_v = ctdb_logfile_log;
-		ctdb->log->logfile = talloc_strdup(ctdb, logfile);
 
 		ctdb->log->fd = open(logfile, O_WRONLY|O_APPEND|O_CREAT, 0666);
 		if (ctdb->log->fd == -1) {
-			printf("Failed to open logfile %s\n", ctdb->logfile);
+			printf("Failed to open logfile %s\n", logfile);
 			abort();
 		}
 	}
@@ -191,6 +210,7 @@ static void ctdb_log_handler(struct event_context *ev, struct fd_event *fde,
 int ctdb_set_child_logging(struct ctdb_context *ctdb)
 {
 	int p[2];
+	int ret;
 
 	if (ctdb->log->fd == 1) {
 		/* not needed for stdout logging */
@@ -211,11 +231,19 @@ int ctdb_set_child_logging(struct ctdb_context *ctdb)
 	close(1);
 	close(2);
 	if (p[1] != 1) {
-		dup2(p[1], 1);
+		ret = dup2(p[1], 1);
+		if (ret == -1) {
+			printf("dup2 failed: %s\n", strerror(errno));
+			return -1;
+		}
 		close(p[1]);
 	}
 	/* also catch stderr of subcommands to the log */
-	dup2(1, 2);
+	ret = dup2(1, 2);
+	if (ret == -1) {
+		printf("dup2 failed: %s\n", strerror(errno));
+		return -1;
+	}
 
 	return 0;
 }
diff --git a/server/ctdb_server.c b/server/ctdb_server.c
index d9a3234..bd1d7ed 100644
--- a/server/ctdb_server.c
+++ b/server/ctdb_server.c
@@ -31,6 +31,8 @@
 int ctdb_set_transport(struct ctdb_context *ctdb, const char *transport)
 {
 	ctdb->transport = talloc_strdup(ctdb, transport);
+	CTDB_NO_MEMORY(ctdb, ctdb->transport);
+
 	return 0;
 }
 
@@ -57,6 +59,8 @@ int ctdb_ip_to_nodeid(struct ctdb_context *ctdb, const char *nodeip)
 int ctdb_set_recovery_lock_file(struct ctdb_context *ctdb, const char *file)
 {
 	ctdb->recovery_lock_file = talloc_strdup(ctdb, file);
+	CTDB_NO_MEMORY(ctdb, ctdb->recovery_lock_file);
+
 	return 0;
 }
 
@@ -145,9 +149,6 @@ int ctdb_set_nlist(struct ctdb_context *ctdb, const char *nlist)
 	ctdb->nodes     = NULL;
 	ctdb->num_nodes = 0;
 
-	talloc_free(ctdb->node_list_file);
-	ctdb->node_list_file = talloc_strdup(ctdb, nlist);
-
 	lines = file_lines_load(nlist, &nlines, ctdb);
 	if (lines == NULL) {
 		ctdb_set_error(ctdb, "Failed to load nlist '%s'\n", nlist);
diff --git a/server/ctdb_takeover.c b/server/ctdb_takeover.c
index 29c0ee6..9eac660 100644
--- a/server/ctdb_takeover.c
+++ b/server/ctdb_takeover.c
@@ -326,6 +326,7 @@ static void release_ip_callback(struct ctdb_context *ctdb, int status,
 	   that the cluster has been reconfigured and they should
 	   release any sockets on this IP */
 	data.dptr = (uint8_t *)talloc_strdup(state, ctdb_addr_to_str(state->addr));
+	CTDB_NO_MEMORY_VOID(ctdb, data.dptr);
 	data.dsize = strlen((char *)data.dptr)+1;
 
 	DEBUG(DEBUG_INFO,(__location__ " sending RELEASE_IP for '%s'\n", data.dptr));
@@ -444,6 +445,7 @@ static int ctdb_add_public_address(struct ctdb_context *ctdb, ctdb_sock_addr *ad
 	vnn = talloc_zero(ctdb, struct ctdb_vnn);
 	CTDB_NO_MEMORY_FATAL(ctdb, vnn);
 	vnn->iface = talloc_strdup(vnn, iface);
+	CTDB_NO_MEMORY(ctdb, vnn->iface);
 	vnn->public_address      = *addr;
 	vnn->public_netmask_bits = mask;
 	vnn->pnn                 = -1;
diff --git a/server/eventscript.c b/server/eventscript.c
index a30ac3f..14cd190 100644
--- a/server/eventscript.c
+++ b/server/eventscript.c
@@ -151,6 +151,7 @@ int32_t ctdb_control_event_script_start(struct ctdb_context *ctdb, TDB_DATA inda
 
 	script->next  = monitoring_status->scripts;
 	script->name  = talloc_strdup(script, name);
+	CTDB_NO_MEMORY(ctdb, script->name);
 	script->start = timeval_current();
 	monitoring_status->scripts = script;
 
@@ -298,6 +299,7 @@ static int ctdb_event_script_v(struct ctdb_context *ctdb, const char *options)
 	char *script;
 	int count;
 	int is_monitor = 0;
+	char *d_name_dup;
 
 	if (!strcmp(options, "monitor")) {
 		is_monitor = 1;
@@ -409,7 +411,9 @@ static int ctdb_event_script_v(struct ctdb_context *ctdb, const char *options)
 		
 		
 		/* store the event script in the tree */
-		trbt_insert32(tree, (num<<16)|count++, talloc_strdup(tree, de->d_name));
+		d_name_dup = talloc_strdup(tree, de->d_name);
+		CTDB_NO_MEMORY(ctdb, d_name_dup);
+		trbt_insert32(tree, (num<<16)|count++, d_name_dup);
 	}
 	closedir(dir);
 
diff --git a/tests/src/ctdb_persistent.c b/tests/src/ctdb_persistent.c
index 8f0452a..2401255 100644
--- a/tests/src/ctdb_persistent.c
+++ b/tests/src/ctdb_persistent.c
@@ -71,6 +71,7 @@ static void check_counters(struct ctdb_context *ctdb, TDB_DATA data)
 {
 	int i;
 	uint32_t *counters, *old_counters;
+	unsigned char *tmp_dptr;
 
 	counters     = (uint32_t *)data.dptr;
 	old_counters = (uint32_t *)old_data.dptr;
@@ -86,7 +87,14 @@ static void check_counters(struct ctdb_context *ctdb, TDB_DATA data)
 
 	if (old_data.dsize != data.dsize) {
 		old_data.dsize = data.dsize;
-		old_data.dptr = talloc_realloc_size(ctdb, old_data.dptr, old_data.dsize);
+		tmp_dptr = talloc_realloc_size(ctdb, old_data.dptr, old_data.dsize);
+		if (tmp_dptr == NULL) {
+			printf("[%4u] ERROR: talloc_realloc_size failed.\n", getpid());
+			success = false;
+			return;
+		} else {
+			old_data.dptr = tmp_dptr;
+		}
 	}
 
 	memcpy(old_data.dptr, data.dptr, data.dsize);
diff --git a/tools/ctdb.c b/tools/ctdb.c
index b85354c..57e1a8d 100644
--- a/tools/ctdb.c
+++ b/tools/ctdb.c
@@ -424,6 +424,7 @@ static int control_xpnn(struct ctdb_context *ctdb, int argc, const char **argv)
 		pnn_node = talloc(mem_ctx, struct pnn_node);
 		pnn_node->pnn = pnn++;
 		pnn_node->addr = talloc_strdup(pnn_node, node);
+		CTDB_NO_MEMORY(ctdb, pnn_node->addr);
 		pnn_node->next = pnn_nodes;
 		pnn_nodes = pnn_node;
 	}
@@ -597,6 +598,7 @@ static int control_natgwlist(struct ctdb_context *ctdb, int argc, const char **a
 		}
 		natgw_node = talloc(ctdb, struct natgw_node);
 		natgw_node->addr = talloc_strdup(natgw_node, node);
+		CTDB_NO_MEMORY(ctdb, natgw_node->addr);
 		natgw_node->next = natgw_nodes;
 		natgw_nodes = natgw_node;
 	}
@@ -2364,7 +2366,8 @@ static int control_backupdb(struct ctdb_context *ctdb, int argc, const char **ar
 	struct db_file_header dbhdr;
 	struct ctdb_db_context *ctdb_db;
 	struct backup_data *bd;
-	int fh;
+	int fh = -1;
+	int status = -1;
 
 	if (argc != 2) {
 		DEBUG(DEBUG_ERR,("Invalid arguments\n"));
@@ -2397,6 +2400,7 @@ static int control_backupdb(struct ctdb_context *ctdb, int argc, const char **ar
 	ctdb_db = ctdb_attach(ctdb, argv[0], dbmap->dbs[i].persistent, 0);
 	if (ctdb_db == NULL) {
 		DEBUG(DEBUG_ERR,("Unable to attach to database '%s'\n", argv[0]));


-- 
CTDB repository


More information about the samba-cvs mailing list