summaryrefslogtreecommitdiffstats
path: root/source4/ldap_server
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2008-03-29 13:32:15 +1100
committerAndrew Bartlett <abartlet@samba.org>2008-03-29 13:32:15 +1100
commit1c1c6fca660c304630672e87c20819daf8e008fc (patch)
tree5c8e323ce94d7dbba93570c344f97716ab5e788a /source4/ldap_server
parente0c90d613121432700ea44011fda51e623de996c (diff)
downloadsamba-1c1c6fca660c304630672e87c20819daf8e008fc.tar.gz
samba-1c1c6fca660c304630672e87c20819daf8e008fc.tar.xz
samba-1c1c6fca660c304630672e87c20819daf8e008fc.zip
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)
Diffstat (limited to 'source4/ldap_server')
-rw-r--r--source4/ldap_server/ldap_backend.c5
-rw-r--r--source4/ldap_server/ldap_server.c4
2 files changed, 8 insertions, 1 deletions
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;
diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c
index 5b2519c035a..ce80941e03f 100644
--- a/source4/ldap_server/ldap_server.c
+++ b/source4/ldap_server/ldap_server.c
@@ -155,8 +155,10 @@ static NTSTATUS ldapsrv_decode(void *private, DATA_BLOB blob)
}
data_blob_free(&blob);
- ldapsrv_process_message(conn, msg);
+ talloc_steal(conn, msg);
asn1_free(asn1);
+
+ ldapsrv_process_message(conn, msg);
return NT_STATUS_OK;
}