summaryrefslogtreecommitdiffstats
path: root/src/responder/ssh/sshsrv.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/ssh/sshsrv.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/ssh/sshsrv.c')
-rw-r--r--src/responder/ssh/sshsrv.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/responder/ssh/sshsrv.c b/src/responder/ssh/sshsrv.c
index 80a558b52..fe6956aba 100644
--- a/src/responder/ssh/sshsrv.c
+++ b/src/responder/ssh/sshsrv.c
@@ -109,7 +109,7 @@ int ssh_process_init(TALLOC_CTX *mem_ctx,
&ssh_dp_interface,
&ssh_ctx->rctx);
if (ret != EOK) {
- return ret;
+ goto fail;
}
ssh_ctx->rctx->pvt_ctx = ssh_ctx;
@@ -121,7 +121,7 @@ int ssh_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 = ssh_ctx->rctx->be_conns; iter; iter = iter->next) {
@@ -139,7 +139,7 @@ int ssh_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;
}
/* Get ssh_known_hosts_timeout option */
@@ -150,12 +150,16 @@ int ssh_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, ("SSH Initialization complete\n"));
return EOK;
+
+fail:
+ talloc_free(ssh_ctx);
+ return ret;
}
int main(int argc, const char *argv[])