summaryrefslogtreecommitdiff
path: root/src/responder/pac
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/pac
parentdfe84158c49e44f2207b94d25e61ab4f3fe38366 (diff)
downloadsssd-6f8ae17869f4f8a1496e3f171ae6b5c11af1845c.tar.gz
sssd-6f8ae17869f4f8a1496e3f171ae6b5c11af1845c.tar.bz2
sssd-6f8ae17869f4f8a1496e3f171ae6b5c11af1845c.zip
do not leak memory on failure in *_process_init()
Diffstat (limited to 'src/responder/pac')
-rw-r--r--src/responder/pac/pacsrv.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/responder/pac/pacsrv.c b/src/responder/pac/pacsrv.c
index 036dd6a5..29447c47 100644
--- a/src/responder/pac/pacsrv.c
+++ b/src/responder/pac/pacsrv.c
@@ -145,7 +145,7 @@ int pac_process_init(TALLOC_CTX *mem_ctx,
"PAC", &pac_dp_interface,
&pac_ctx->rctx);
if (ret != EOK) {
- return ret;
+ goto fail;
}
pac_ctx->rctx->pvt_ctx = pac_ctx;
@@ -155,7 +155,7 @@ int pac_process_init(TALLOC_CTX *mem_ctx,
DEFAULT_ALLOWED_UIDS, &uid_str);
if (ret != EOK) {
DEBUG(SSSDBG_FATAL_FAILURE, ("Failed to get allowed UIDs.\n"));
- return ret;
+ goto fail;
}
ret = csv_string_to_uid_array(pac_ctx->rctx, uid_str, true,
@@ -163,7 +163,7 @@ int pac_process_init(TALLOC_CTX *mem_ctx,
&pac_ctx->rctx->allowed_uids);
if (ret != EOK) {
DEBUG(SSSDBG_FATAL_FAILURE, ("Failed to set allowed UIDs.\n"));
- return ret;
+ goto fail;
}
/* Enable automatic reconnection to the Data Provider */
@@ -173,7 +173,7 @@ int pac_process_init(TALLOC_CTX *mem_ctx,
3, &max_retries);
if (ret != EOK) {
DEBUG(SSSDBG_FATAL_FAILURE, ("Failed to set up automatic reconnection\n"));
- return ret;
+ goto fail;
}
for (iter = pac_ctx->rctx->be_conns; iter; iter = iter->next) {
@@ -185,7 +185,8 @@ int pac_process_init(TALLOC_CTX *mem_ctx,
&pac_ctx->idmap_ctx);
if (err != IDMAP_SUCCESS) {
DEBUG(SSSDBG_FATAL_FAILURE, ("sss_idmap_init failed.\n"));
- return EFAULT;
+ ret = EFAULT;
+ goto fail;
}
/* Set up file descriptor limits */
@@ -197,13 +198,17 @@ int pac_process_init(TALLOC_CTX *mem_ctx,
if (ret != EOK) {
DEBUG(SSSDBG_FATAL_FAILURE,
("Failed to set up file descriptor limit\n"));
- return ret;
+ goto fail;
}
responder_set_fd_limit(fd_limit);
DEBUG(SSSDBG_TRACE_FUNC, ("PAC Initialization complete\n"));
return EOK;
+
+fail:
+ talloc_free(pac_ctx);
+ return ret;
}
int main(int argc, const char *argv[])