summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-12-01 21:16:32 +1100
committerAndrew Tridgell <tridge@samba.org>2006-12-01 21:16:32 +1100
commit6f139e6e91a42a809b4f5b82af0ca7dd20987cfe (patch)
treea0a4d22fbf64c0f028f11de169dbd6e4e5a4ae28
parent35a627cc32ea682beabea577ed481cf41e4b4030 (diff)
parent606a4d9113e4a0f900bbef37a9adb1661c7a52c7 (diff)
downloadsamba-6f139e6e91a42a809b4f5b82af0ca7dd20987cfe.tar.gz
samba-6f139e6e91a42a809b4f5b82af0ca7dd20987cfe.tar.xz
samba-6f139e6e91a42a809b4f5b82af0ca7dd20987cfe.zip
merge from ab
(This used to be ctdb commit 8b3f9c901ad4b1485eb4b514da8466a0b50ef726)
-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