summaryrefslogtreecommitdiff
path: root/source4/lib/messaging
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-07-17 14:09:14 +0000
committerVolker Lendecke <vl@samba.org>2014-07-21 18:00:10 +0200
commit5db77591f51676461073acde9a1e0ab0eb1622b4 (patch)
tree712722b61125b7856c81ca6ea10c6509332bce4b /source4/lib/messaging
parent1603d2df592fb1861467e02de4bcadcc6772f162 (diff)
downloadsamba-5db77591f51676461073acde9a1e0ab0eb1622b4.tar.gz
messaging4: Move str_list_add
If this fails, we'd have to revert the tdb_append. str_list_remove is simpler :-) Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source4/lib/messaging')
-rw-r--r--source4/lib/messaging/messaging.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c
index 5def9d1f734..dde796f8d17 100644
--- a/source4/lib/messaging/messaging.c
+++ b/source4/lib/messaging/messaging.c
@@ -930,21 +930,22 @@ NTSTATUS irpc_add_name(struct imessaging_context *msg_ctx, const char *name)
int ret;
NTSTATUS status = NT_STATUS_OK;
+ msg_ctx->names = str_list_add(msg_ctx->names, name);
+ if (msg_ctx->names == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ talloc_steal(msg_ctx, msg_ctx->names);
+
key = string_term_tdb_data(name);
data = (TDB_DATA) { .dptr = (uint8_t *)&pid, .dsize = sizeof(pid) };
ret = tdb_append(t, key, data);
if (ret != 0) {
enum TDB_ERROR err = tdb_error(t);
+ str_list_remove(msg_ctx->names, name);
return map_nt_error_from_tdb(err);
}
- msg_ctx->names = str_list_add(msg_ctx->names, name);
- if (msg_ctx->names == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
- talloc_steal(msg_ctx, msg_ctx->names);
-
return status;
}