diff options
author | Volker Lendecke <vl@samba.org> | 2014-03-27 10:07:34 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-03-31 22:52:14 +0200 |
commit | 193bd7d9761ffd63487892b75e076ed2d46a9731 (patch) | |
tree | 94ea8354eb7e8d5f2cab849159dc725388ac051e /source4/lib | |
parent | d6db35d7a564ee556b74131ef4c3a3cdb8097e14 (diff) | |
download | samba-193bd7d9761ffd63487892b75e076ed2d46a9731.tar.gz samba-193bd7d9761ffd63487892b75e076ed2d46a9731.tar.xz samba-193bd7d9761ffd63487892b75e076ed2d46a9731.zip |
messaging4: Add "goto fail" to imessaging_init
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/messaging/messaging.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index ba1c5bd727c..b1b0003e7bd 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -590,24 +590,21 @@ struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx, /* setup a handler for messages from other cluster nodes, if appropriate */ status = cluster_message_init(msg, server_id, cluster_message_handler); if (!NT_STATUS_IS_OK(status)) { - talloc_free(msg); - return NULL; + goto fail; } /* create the messaging directory if needed */ msg->lp_ctx = talloc_reference(msg, lp_ctx); if (!msg->lp_ctx) { - talloc_free(msg); - return NULL; + goto fail; } msg->base_path = lpcfg_imessaging_path(msg, lp_ctx); ok = directory_create_or_exist_strict(msg->base_path, geteuid(), 0700); if (!ok) { - talloc_free(msg); - return NULL; + goto fail; } msg->path = imessaging_path(msg, server_id); @@ -618,8 +615,7 @@ struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx, status = socket_create("unix", SOCKET_TYPE_DGRAM, &msg->sock, 0); if (!NT_STATUS_IS_OK(status)) { - talloc_free(msg); - return NULL; + goto fail; } /* by stealing here we ensure that the socket is cleaned up (and even @@ -629,15 +625,13 @@ struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx, path = socket_address_from_strings(msg, msg->sock->backend_name, msg->path, 0); if (!path) { - talloc_free(msg); - return NULL; + goto fail; } status = socket_listen(msg->sock, path, 50, 0); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("Unable to setup messaging listener for '%s':%s\n", msg->path, nt_errstr(status))); - talloc_free(msg); - return NULL; + goto fail; } /* it needs to be non blocking for sends */ @@ -657,6 +651,9 @@ struct imessaging_context *imessaging_init(TALLOC_CTX *mem_ctx, IRPC_REGISTER(msg, irpc, IRPC_UPTIME, irpc_uptime, msg); return msg; +fail: + talloc_free(msg); + return NULL; } /* |