[PATCH] s4:ldb_map: Don't free ares too early.

Andrew Kroeger andrew at id10ts.net
Thu Sep 10 09:04:47 MDT 2009


As found when running "make test" with the MALLOC_CHECK_ and MALLOC_PERTURB_
environment variables set.
---
 source4/lib/ldb/ldb_map/ldb_map_outbound.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/source4/lib/ldb/ldb_map/ldb_map_outbound.c b/source4/lib/ldb/ldb_map/ldb_map_outbound.c
index 4487d7e..5f5be89 100644
--- a/source4/lib/ldb/ldb_map/ldb_map_outbound.c
+++ b/source4/lib/ldb/ldb_map/ldb_map_outbound.c
@@ -1250,15 +1250,15 @@ static int map_remote_search_callback(struct ldb_request *req,
 						ares->response, LDB_SUCCESS);
 		}
 
-		talloc_free(ares);
-
 		/* reset the pointer to the start of the list */
 		ac->r_current = ac->r_list;
 
 		/* no entry just return */
 		if (ac->r_current == NULL) {
-			return ldb_module_done(ac->req, ares->controls,
+			ret = ldb_module_done(ac->req, ares->controls,
 						ares->response, LDB_SUCCESS);
+			talloc_free(ares);
+			return ret;
 		}
 
 		ret = map_search_local(ac);
-- 
1.6.0.6


--------------080600070501000709000002--


More information about the samba-technical mailing list