summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb_tdb
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-10-20 14:08:53 +0200
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-10-20 12:31:05 +0000
commitec43a4d29e3bb395e7a8d7edafb6dedfeb9baec2 (patch)
tree992e302838dd3835ed729c32f5d4e89a8aa11397 /source4/lib/ldb/ldb_tdb
parent06053a09cbf42cde12d69d0a296fb25f425aae67 (diff)
downloadsamba-ec43a4d29e3bb395e7a8d7edafb6dedfeb9baec2.tar.gz
samba-ec43a4d29e3bb395e7a8d7edafb6dedfeb9baec2.tar.bz2
samba-ec43a4d29e3bb395e7a8d7edafb6dedfeb9baec2.zip
ldb:ldb_cache.c - fix memory contexts and memory leaks
Diffstat (limited to 'source4/lib/ldb/ldb_tdb')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_cache.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_cache.c b/source4/lib/ldb/ldb_tdb/ldb_cache.c
index 114eadaff5..6b1eb5b148 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_cache.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_cache.c
@@ -298,7 +298,7 @@ int ltdb_cache_load(struct ldb_module *module)
baseinfo = ldb_msg_new(ltdb->cache);
if (baseinfo == NULL) goto failed;
- baseinfo_dn = ldb_dn_new(module, ldb, LTDB_BASEINFO);
+ baseinfo_dn = ldb_dn_new(baseinfo, ldb, LTDB_BASEINFO);
if (baseinfo_dn == NULL) goto failed;
r= ltdb_search_dn1(module, baseinfo_dn, baseinfo);
@@ -351,6 +351,7 @@ int ltdb_cache_load(struct ldb_module *module)
ltdb_attributes_unload(module);
talloc_free(ltdb->cache->indexlist);
+ talloc_free(ltdb->cache->attributes);
ltdb->cache->indexlist = ldb_msg_new(ltdb->cache);
ltdb->cache->attributes = ldb_msg_new(ltdb->cache);
@@ -383,14 +384,12 @@ int ltdb_cache_load(struct ldb_module *module)
done:
talloc_free(options);
talloc_free(baseinfo);
- talloc_free(baseinfo_dn);
talloc_free(indexlist_dn);
return 0;
failed:
talloc_free(options);
talloc_free(baseinfo);
- talloc_free(baseinfo_dn);
talloc_free(indexlist_dn);
return -1;
}
@@ -422,6 +421,7 @@ int ltdb_increase_sequence_number(struct ldb_module *module)
s = talloc_asprintf(msg, "%llu", ltdb->sequence_number+1);
if (!s) {
+ talloc_free(msg);
errno = ENOMEM;
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -458,6 +458,7 @@ int ltdb_increase_sequence_number(struct ldb_module *module)
s = ldb_timestring(msg, t);
if (s == NULL) {
+ talloc_free(msg);
return LDB_ERR_OPERATIONS_ERROR;
}