From da45d5215d1da2a1ff1b72b9bc3f10ec2192fba9 Mon Sep 17 00:00:00 2001
From: Andrew Bartlett <abartlet@samba.org>
Date: Mon, 6 Jul 2009 09:24:18 +1000
Subject: s4:ldb Fix talloc hirarchy in LDIF parsing code

The problem here was that some parts of the ldb_message were still
attached to the ldb_ldif structure, and when only the message was
taken (and the ldif free'ed to reclaim memory) we refereced free'ed
memory.

Andrew Bartlett
---
 source4/lib/ldb/common/ldb_ldif.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'source4/lib/ldb/common')

diff --git a/source4/lib/ldb/common/ldb_ldif.c b/source4/lib/ldb/common/ldb_ldif.c
index 400fb352ff..d64a9f1c3a 100644
--- a/source4/lib/ldb/common/ldb_ldif.c
+++ b/source4/lib/ldb/common/ldb_ldif.c
@@ -632,7 +632,7 @@ struct ldb_ldif *ldb_ldif_read(struct ldb_context *ldb,
 			if (!el->values) {
 				goto failed;
 			}
-			ret = a->syntax->ldif_read_fn(ldb, ldif, &value, &el->values[el->num_values]);
+			ret = a->syntax->ldif_read_fn(ldb, el->values, &value, &el->values[el->num_values]);
 			if (ret != 0) {
 				goto failed;
 			}
@@ -647,7 +647,7 @@ struct ldb_ldif *ldb_ldif_read(struct ldb_context *ldb,
 			el->num_values++;
 		} else {
 			/* its a new attribute */
-			msg->elements = talloc_realloc(ldif, msg->elements, 
+			msg->elements = talloc_realloc(msg, msg->elements, 
 							 struct ldb_message_element, 
 							 msg->num_elements+1);
 			if (!msg->elements) {
@@ -661,7 +661,7 @@ struct ldb_ldif *ldb_ldif_read(struct ldb_context *ldb,
 				goto failed;
 			}
 			el->num_values = 1;
-			ret = a->syntax->ldif_read_fn(ldb, ldif, &value, &el->values[0]);
+			ret = a->syntax->ldif_read_fn(ldb, el->values, &value, &el->values[0]);
 			if (ret != 0) {
 				goto failed;
 			}
-- 
cgit