summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb_tdb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-05-06 07:30:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:51:46 -0500
commit7216d23ba5eef36872196eaeb0b629fe0cf272c5 (patch)
treef8eaf6015afff2c1bedd1a9ec143c83171dbf208 /source4/lib/ldb/ldb_tdb
parent8db2f256e467ec9aaa129a34ef28b8eac3721251 (diff)
downloadsamba-7216d23ba5eef36872196eaeb0b629fe0cf272c5.tar.gz
samba-7216d23ba5eef36872196eaeb0b629fe0cf272c5.tar.bz2
samba-7216d23ba5eef36872196eaeb0b629fe0cf272c5.zip
r509: fixed a memory handling bug that affects ldb with memory pools that
change with each request (This used to be commit 18695cefa16b867427e3ca2fb0d787d850ea25c3)
Diffstat (limited to 'source4/lib/ldb/ldb_tdb')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_cache.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_cache.c b/source4/lib/ldb/ldb_tdb/ldb_cache.c
index 6734de9fd8..87e9538d01 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_cache.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_cache.c
@@ -226,6 +226,7 @@ int ltdb_attribute_flags(struct ldb_context *ldb, const char *attr_name)
};
size_t len;
int i, ret=0;
+ struct ldb_alloc_ops alloc = ldb->alloc_ops;
if (ltdb->cache.last_attribute.name &&
ldb_attr_cmp(ltdb->cache.last_attribute.name, attr_name) == 0) {
@@ -257,10 +258,14 @@ int ltdb_attribute_flags(struct ldb_context *ldb, const char *attr_name)
attrs += strspn(attrs, " ,");
}
- if (ltdb->cache.last_attribute.name) ldb_free(ldb, ltdb->cache.last_attribute.name);
+ ldb->alloc_ops.alloc = NULL;
+
+ ldb_free(ldb, ltdb->cache.last_attribute.name);
ltdb->cache.last_attribute.name = ldb_strdup(ldb, attr_name);
ltdb->cache.last_attribute.flags = ret;
+
+ ldb->alloc_ops = alloc;
return ret;
}