From a129ad36eb34bbeda80c75b2f8d771bdaca8451e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 13 Sep 2005 22:05:45 +0000 Subject: r10213: fixed a memory leak in the ldap client and server code spotted by Karl Melcher. ldap_encode() now takes a memory context to use for the data blob (This used to be commit 09948a59336a7f02bf2b4605f2d4d886e65b85f2) --- source4/libcli/cldap/cldap.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'source4/libcli/cldap') diff --git a/source4/libcli/cldap/cldap.c b/source4/libcli/cldap/cldap.c index 4ffa40d134..07744553c8 100644 --- a/source4/libcli/cldap/cldap.c +++ b/source4/libcli/cldap/cldap.c @@ -337,12 +337,11 @@ struct cldap_request *cldap_search_send(struct cldap_socket *cldap, goto failed; } - if (!ldap_encode(msg, &req->encoded)) { + if (!ldap_encode(msg, &req->encoded, req)) { DEBUG(0,("Failed to encode cldap message to %s:%d\n", req->dest_addr, req->dest_port)); goto failed; } - talloc_steal(req, req->encoded.data); DLIST_ADD_END(cldap->send_queue, req, struct cldap_request *); @@ -389,13 +388,12 @@ NTSTATUS cldap_reply_send(struct cldap_socket *cldap, struct cldap_reply *io) msg->type = LDAP_TAG_SearchResultEntry; msg->r.SearchResultEntry = *io->response; - if (!ldap_encode(msg, &blob1)) { + if (!ldap_encode(msg, &blob1, req)) { DEBUG(0,("Failed to encode cldap message to %s:%d\n", req->dest_addr, req->dest_port)); status = NT_STATUS_INVALID_PARAMETER; goto failed; } - talloc_steal(req, blob1.data); } else { blob1 = data_blob(NULL, 0); } @@ -403,13 +401,12 @@ NTSTATUS cldap_reply_send(struct cldap_socket *cldap, struct cldap_reply *io) msg->type = LDAP_TAG_SearchResultDone; msg->r.SearchResultDone = *io->result; - if (!ldap_encode(msg, &blob2)) { + if (!ldap_encode(msg, &blob2, req)) { DEBUG(0,("Failed to encode cldap message to %s:%d\n", req->dest_addr, req->dest_port)); status = NT_STATUS_INVALID_PARAMETER; goto failed; } - talloc_steal(req, blob2.data); req->encoded = data_blob_talloc(req, NULL, blob1.length + blob2.length); if (req->encoded.data == NULL) goto failed; -- cgit