summaryrefslogtreecommitdiffstats
path: root/src/responder/nss
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/nss
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/nss')
-rw-r--r--src/responder/nss/nsssrv.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/responder/nss/nsssrv.c b/src/responder/nss/nsssrv.c
index 083e91d7f..e5334129d 100644
--- a/src/responder/nss/nsssrv.c
+++ b/src/responder/nss/nsssrv.c
@@ -412,7 +412,7 @@ int nss_process_init(TALLOC_CTX *mem_ctx,
ret = sss_ncache_init(nctx, &nctx->ncache);
if (ret != EOK) {
DEBUG(0, ("fatal error initializing negative cache\n"));
- return ret;
+ goto fail;
}
nss_cmds = get_nss_cmds();
@@ -427,14 +427,14 @@ int nss_process_init(TALLOC_CTX *mem_ctx,
"NSS", &nss_dp_interface,
&nctx->rctx);
if (ret != EOK) {
- return ret;
+ goto fail;
}
nctx->rctx->pvt_ctx = nctx;
ret = nss_get_config(nctx, cdb);
if (ret != EOK) {
DEBUG(0, ("fatal error getting nss config\n"));
- return ret;
+ goto fail;
}
/* Enable automatic reconnection to the Data Provider */
@@ -444,7 +444,7 @@ int nss_process_init(TALLOC_CTX *mem_ctx,
3, &max_retries);
if (ret != EOK) {
DEBUG(0, ("Failed to set up automatic reconnection\n"));
- return ret;
+ goto fail;
}
for (iter = nctx->rctx->be_conns; iter; iter = iter->next) {
@@ -456,7 +456,8 @@ int nss_process_init(TALLOC_CTX *mem_ctx,
hret = sss_hash_create(nctx, 10, &nctx->netgroups);
if (hret != HASH_SUCCESS) {
DEBUG(0,("Unable to initialize netgroup hash table\n"));
- return EIO;
+ ret = EIO;
+ goto fail;
}
/* create mmap caches */
@@ -476,7 +477,7 @@ int nss_process_init(TALLOC_CTX *mem_ctx,
300, &memcache_timeout);
if (ret != EOK) {
DEBUG(0, ("Failed to set up automatic reconnection\n"));
- return ret;
+ goto fail;
}
/* TODO: read cache sizes from configuration */
@@ -503,13 +504,17 @@ int nss_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, ("NSS Initialization complete\n"));
return EOK;
+
+fail:
+ talloc_free(nctx);
+ return ret;
}
int main(int argc, const char *argv[])