summaryrefslogtreecommitdiffstats
path: root/src/responder/sudo/sudosrv.c
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2012-10-19 11:31:08 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-03-20 13:29:29 +0100
commit6f8ae17869f4f8a1496e3f171ae6b5c11af1845c (patch)
treecc845f8e4f68de80e5aaf43d7a136049dad8a741 /src/responder/sudo/sudosrv.c
parentdfe84158c49e44f2207b94d25e61ab4f3fe38366 (diff)
downloadsssd-6f8ae17869f4f8a1496e3f171ae6b5c11af1845c.tar.gz
sssd-6f8ae17869f4f8a1496e3f171ae6b5c11af1845c.tar.xz
sssd-6f8ae17869f4f8a1496e3f171ae6b5c11af1845c.zip
do not leak memory on failure in *_process_init()
Diffstat (limited to 'src/responder/sudo/sudosrv.c')
-rw-r--r--src/responder/sudo/sudosrv.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/responder/sudo/sudosrv.c b/src/responder/sudo/sudosrv.c
index cbcbe2132..408176010 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[])