summaryrefslogtreecommitdiff
path: root/lib/ldb/common
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2016-01-25 12:40:53 +0100
committerGünther Deschner <gd@samba.org>2016-02-03 15:04:11 +0100
commitd56e42de64af84ad839749beaa22450f71bec58a (patch)
tree7b218b3c96454df7a9b30e4366511892fd921d68 /lib/ldb/common
parent11c5513bb121fd43f566eacfe7b2af64f3cb3a83 (diff)
downloadsamba-d56e42de64af84ad839749beaa22450f71bec58a.tar.gz
ldb: Avoid a "talloc_steal"
There's only one caller of "next_chunk" that does a talloc_steal right after the call. Pass in a talloc context. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'lib/ldb/common')
-rw-r--r--lib/ldb/common/ldb_ldif.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/ldb/common/ldb_ldif.c b/lib/ldb/common/ldb_ldif.c
index a8ad4aae7bc..07de5179ba7 100644
--- a/lib/ldb/common/ldb_ldif.c
+++ b/lib/ldb/common/ldb_ldif.c
@@ -417,7 +417,7 @@ int ldb_ldif_write(struct ldb_context *ldb,
caller frees
*/
-static char *next_chunk(struct ldb_context *ldb,
+static char *next_chunk(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
int (*fgetc_fn)(void *), void *private_data)
{
size_t alloc_size=0, chunk_size = 0;
@@ -429,7 +429,7 @@ static char *next_chunk(struct ldb_context *ldb,
if (chunk_size+1 >= alloc_size) {
char *c2;
alloc_size += 1024;
- c2 = talloc_realloc(ldb, chunk, char, alloc_size);
+ c2 = talloc_realloc(mem_ctx, chunk, char, alloc_size);
if (!c2) {
talloc_free(chunk);
errno = ENOMEM;
@@ -774,11 +774,10 @@ struct ldb_ldif *ldb_ldif_read(struct ldb_context *ldb,
msg->elements = NULL;
msg->num_elements = 0;
- chunk = next_chunk(ldb, fgetc_fn, private_data);
+ chunk = next_chunk(ldb, ldif, fgetc_fn, private_data);
if (!chunk) {
goto failed;
}
- talloc_steal(ldif, chunk);
s = chunk;