summaryrefslogtreecommitdiff
path: root/src/db
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2011-04-13 15:21:43 -0400
committerStephen Gallagher <sgallagh@redhat.com>2011-04-15 11:37:41 -0400
commit854da1d148cce68222c387af72293bfb46b9b8f3 (patch)
tree323eef5ed83723c557e89f61bcc06c63a8da6472 /src/db
parentd9aadca8dd6676c8af03c3fbed06b7e89b4f97b1 (diff)
downloadsssd-854da1d148cce68222c387af72293bfb46b9b8f3.tar.gz
sssd-854da1d148cce68222c387af72293bfb46b9b8f3.tar.bz2
sssd-854da1d148cce68222c387af72293bfb46b9b8f3.zip
Don't leak memory if sysdb_domain_init() fails
Diffstat (limited to 'src/db')
-rw-r--r--src/db/sysdb.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/db/sysdb.c b/src/db/sysdb.c
index 26904f4f..493384d0 100644
--- a/src/db/sysdb.c
+++ b/src/db/sysdb.c
@@ -1595,19 +1595,20 @@ static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
domain->name, db_path,
&ctx->ldb_file);
if (ret != EOK) {
- return ret;
+ goto done;
}
DEBUG(5, ("DB File for %s: %s\n", domain->name, ctx->ldb_file));
ret = sysdb_ldb_connect(ctx, ctx->ldb_file, &ctx->ldb);
if (ret != EOK) {
DEBUG(1, ("sysdb_ldb_connect failed.\n"));
- return ret;
+ goto done;
}
tmp_ctx = talloc_new(ctx);
if (!tmp_ctx) {
- return ENOMEM;
+ ret = ENOMEM;
+ goto done;
}
verdn = ldb_dn_new(tmp_ctx, ctx->ldb, SYSDB_BASE);
@@ -1785,6 +1786,8 @@ static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
done:
if (ret == EOK) {
*_ctx = ctx;
+ } else {
+ talloc_free(ctx);
}
talloc_free(tmp_ctx);
return ret;