summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ctdb/common/ctdb_call.c6
-rw-r--r--ctdb/include/ctdb_private.h4
2 files changed, 7 insertions, 3 deletions
diff --git a/ctdb/common/ctdb_call.c b/ctdb/common/ctdb_call.c
index c6dff1e5c0..a2219403a2 100644
--- a/ctdb/common/ctdb_call.c
+++ b/ctdb/common/ctdb_call.c
@@ -186,7 +186,7 @@ struct ctdb_call_state *ctdb_call_local_send(struct ctdb_context *ctdb,
int ret;
state = talloc_zero(ctdb, struct ctdb_call_state);
- CTDB_NO_MEMORY(ctdb, state);
+ CTDB_NO_MEMORY_NULL(ctdb, state);
state->state = CTDB_CALL_DONE;
state->node = ctdb->nodes[ctdb->vnn];
@@ -213,11 +213,11 @@ struct ctdb_call_state *ctdb_call_send(struct ctdb_context *ctdb,
}
state = talloc_zero(ctdb, struct ctdb_call_state);
- CTDB_NO_MEMORY(ctdb, state);
+ CTDB_NO_MEMORY_NULL(ctdb, state);
len = sizeof(*state->c) + key.dsize + (call_data?call_data->dsize:0);
state->c = talloc_size(ctdb, len);
- CTDB_NO_MEMORY(ctdb, state->c);
+ CTDB_NO_MEMORY_NULL(ctdb, state->c);
state->c->hdr.length = len;
state->c->hdr.operation = CTDB_REQ_CALL;
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index e2f851749d..32f258b2bf 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -94,6 +94,10 @@ struct ctdb_context {
ctdb_set_error(ctdb, "Out of memory at %s:%d", __FILE__, __LINE__); \
return -1; }} while (0)
+#define CTDB_NO_MEMORY_NULL(ctdb, p) do { if (!(p)) { \
+ ctdb_set_error(ctdb, "Out of memory at %s:%d", __FILE__, __LINE__); \
+ return NULL; }} while (0)
+
/* arbitrary maximum timeout for ctdb operations */
#define CTDB_REQ_TIMEOUT 10