diff options
author | Simo Sorce <ssorce@redhat.com> | 2009-07-31 09:52:14 -0400 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2009-08-10 09:42:18 -0400 |
commit | 2b0f40eaba44742fa38bb5b67ada510e7b2b6324 (patch) | |
tree | 10317ab1e5428020e0363c45a3e943141a14e519 /server/monitor | |
parent | 508b5b2a360c9530c6ea67a7b7ed6d61559846e4 (diff) | |
download | sssd-2b0f40eaba44742fa38bb5b67ada510e7b2b6324.tar.gz sssd-2b0f40eaba44742fa38bb5b67ada510e7b2b6324.tar.bz2 sssd-2b0f40eaba44742fa38bb5b67ada510e7b2b6324.zip |
Remove redundant memory contexts
Simplify code by removing stuff that is never used or redundant.
Diffstat (limited to 'server/monitor')
-rw-r--r-- | server/monitor/monitor_sbus.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/server/monitor/monitor_sbus.c b/server/monitor/monitor_sbus.c index 7a9c8b09..5d49f003 100644 --- a/server/monitor/monitor_sbus.c +++ b/server/monitor/monitor_sbus.c @@ -54,44 +54,38 @@ done: return ret; } -int monitor_init_sbus_methods(TALLOC_CTX *mem_ctx, struct sbus_method *methods, +int monitor_init_sbus_methods(TALLOC_CTX *mem_ctx, + struct sbus_method *methods, struct sbus_method_ctx **sm_ctx) { - int ret; - TALLOC_CTX *tmp_ctx; struct sbus_method_ctx *method_ctx; + int ret; - tmp_ctx = talloc_new(mem_ctx); - if (tmp_ctx == NULL) { - return ENOMEM; - } - - method_ctx = talloc_zero(tmp_ctx, struct sbus_method_ctx); - if (method_ctx == NULL) { + method_ctx = talloc_zero(mem_ctx, struct sbus_method_ctx); + if (!method_ctx) { ret = ENOMEM; - goto done; + goto fail; } method_ctx->interface = talloc_strdup(method_ctx, SERVICE_INTERFACE); if (method_ctx->interface == NULL) { ret = ENOMEM; - goto done; + goto fail; } method_ctx->path = talloc_strdup(method_ctx, SERVICE_PATH); if (method_ctx->path == NULL) { ret = ENOMEM; - goto done; + goto fail; } method_ctx->methods = methods; method_ctx->message_handler = sbus_message_handler; *sm_ctx = method_ctx; - talloc_steal(mem_ctx, method_ctx); - ret = EOK; + return EOK; -done: - talloc_free(tmp_ctx); +fail: + talloc_free(method_ctx); return ret; } |