From 6f8ae17869f4f8a1496e3f171ae6b5c11af1845c Mon Sep 17 00:00:00 2001 From: Pavel Březina Date: Fri, 19 Oct 2012 11:31:08 +0200 Subject: do not leak memory on failure in *_process_init() --- src/responder/sudo/sudosrv.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/responder/sudo/sudosrv.c') diff --git a/src/responder/sudo/sudosrv.c b/src/responder/sudo/sudosrv.c index cbcbe213..40817601 100644 --- a/src/responder/sudo/sudosrv.c +++ b/src/responder/sudo/sudosrv.c @@ -110,7 +110,7 @@ int sudo_process_init(TALLOC_CTX *mem_ctx, &sudo_dp_interface, &sudo_ctx->rctx); if (ret != EOK) { - return ret; + goto fail; } sudo_ctx->rctx->pvt_ctx = sudo_ctx; @@ -122,7 +122,7 @@ int sudo_process_init(TALLOC_CTX *mem_ctx, if (ret != EOK) { DEBUG(SSSDBG_FATAL_FAILURE, ("Failed to set up automatic reconnection\n")); - return ret; + goto fail; } for (iter = sudo_ctx->rctx->be_conns; iter; iter = iter->next) { @@ -140,12 +140,16 @@ int sudo_process_init(TALLOC_CTX *mem_ctx, if (ret != EOK) { DEBUG(SSSDBG_FATAL_FAILURE, ("Error reading from confdb (%d) [%s]\n", ret, strerror(ret))); - return ret; + goto fail; } DEBUG(SSSDBG_TRACE_FUNC, ("SUDO Initialization complete\n")); return EOK; + +fail: + talloc_free(sudo_ctx); + return ret; } int main(int argc, const char *argv[]) -- cgit