From e0c90d613121432700ea44011fda51e623de996c Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 29 Mar 2008 11:18:00 +1100 Subject: Fix some valgrind issues. These small changes seem to fix some of the early issues in 'make valgrindtest' Previously, the subtree_delete code didn't pass on the timeout, leaving it uninitialised. The ldap_server/ldap_backend.c change tidies up the talloc hierarchy a bit. Andrew Bartlett (This used to be commit 95314f29a9cf83db71d37e68728bfb5009fce60d) --- source4/ldap_server/ldap_backend.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/ldap_server/ldap_backend.c') diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c index 346aacaa99c..8b1c3cec693 100644 --- a/source4/ldap_server/ldap_backend.c +++ b/source4/ldap_server/ldap_backend.c @@ -216,9 +216,6 @@ static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call) lreq = talloc(local_ctx, struct ldb_request); NT_STATUS_HAVE_NO_MEMORY(lreq); - res = talloc_zero(local_ctx, struct ldb_result); - NT_STATUS_HAVE_NO_MEMORY(res); - lreq->operation = LDB_SEARCH; lreq->op.search.base = basedn; lreq->op.search.scope = scope; @@ -242,6 +239,9 @@ static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call) } } + res = talloc_zero(lreq, struct ldb_result); + NT_STATUS_HAVE_NO_MEMORY(res); + lreq->context = res; lreq->callback = ldb_search_default_callback; -- cgit From 1c1c6fca660c304630672e87c20819daf8e008fc Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 29 Mar 2008 13:32:15 +1100 Subject: Fix more valgrind issues. This passes down the timeout more consistantly, and ensures that no matter how the modules screw up, we don't free() the memory we are going to write into the ASN1 packet until we actually write it out. Andrew Bartlett (This used to be commit eefd46289b90967ce6b4cd385fb1f7e1d6f9b343) --- source4/ldap_server/ldap_backend.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source4/ldap_server/ldap_backend.c') diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c index 8b1c3cec693..9b43d7bd742 100644 --- a/source4/ldap_server/ldap_backend.c +++ b/source4/ldap_server/ldap_backend.c @@ -261,6 +261,11 @@ static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call) ent_r = ldapsrv_init_reply(call, LDAP_TAG_SearchResultEntry); NT_STATUS_HAVE_NO_MEMORY(ent_r); + /* Better to have the whole message kept here, + * than to find someone further up didn't put + * a value in the right spot in the talloc tree */ + talloc_steal(ent_r, res->msgs[i]); + ent = &ent_r->msg->r.SearchResultEntry; ent->dn = ldb_dn_alloc_linearized(ent_r, res->msgs[i]->dn); ent->num_attributes = 0; -- cgit