diff options
author | Andrew Tridgell <tridge@samba.org> | 2007-05-21 06:12:06 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:52:42 -0500 |
commit | 7bb939b1cb2b39a8271cf16d9f5fce5312a9af10 (patch) | |
tree | 3210fa30663556e6ff238a3c9f6d17a209bf26b4 /source4/libcli/cldap | |
parent | 042ddf28ec036141b2457eb4bf6d2b0cec5cc790 (diff) | |
download | samba-7bb939b1cb2b39a8271cf16d9f5fce5312a9af10.tar.gz samba-7bb939b1cb2b39a8271cf16d9f5fce5312a9af10.tar.bz2 samba-7bb939b1cb2b39a8271cf16d9f5fce5312a9af10.zip |
r23030: finally fixed up our asn1 code to use better memory allocation. This
should allow us to fix some long standing memory leaks.
(This used to be commit 3db49c2ec9968221c1361785b94061046ecd159d)
Diffstat (limited to 'source4/libcli/cldap')
-rw-r--r-- | source4/libcli/cldap/cldap.c | 16 | ||||
-rw-r--r-- | source4/libcli/cldap/cldap.h | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/source4/libcli/cldap/cldap.c b/source4/libcli/cldap/cldap.c index c68a037552..e92abe4d47 100644 --- a/source4/libcli/cldap/cldap.c +++ b/source4/libcli/cldap/cldap.c @@ -66,7 +66,7 @@ static void cldap_socket_recv(struct cldap_socket *cldap) struct socket_address *src; DATA_BLOB blob; size_t nread, dsize; - struct asn1_data asn1; + struct asn1_data *asn1 = asn1_init(tmp_ctx); struct ldap_message *ldap_msg; struct cldap_request *req; @@ -93,12 +93,12 @@ static void cldap_socket_recv(struct cldap_socket *cldap) DEBUG(2,("Received cldap packet of length %d from %s:%d\n", (int)blob.length, src->addr, src->port)); - if (!asn1_load(&asn1, blob)) { + if (!asn1_load(asn1, blob)) { DEBUG(2,("Failed to setup for asn.1 decode\n")); talloc_free(tmp_ctx); return; } - talloc_steal(tmp_ctx, asn1.data); + talloc_steal(tmp_ctx, asn1->data); ldap_msg = talloc(tmp_ctx, struct ldap_message); if (ldap_msg == NULL) { @@ -107,7 +107,7 @@ static void cldap_socket_recv(struct cldap_socket *cldap) } /* this initial decode is used to find the message id */ - status = ldap_decode(&asn1, ldap_msg); + status = ldap_decode(asn1, ldap_msg); if (!NT_STATUS_IS_OK(status)) { DEBUG(2,("Failed to decode ldap message: %s\n", nt_errstr(status))); talloc_free(tmp_ctx); @@ -128,8 +128,8 @@ static void cldap_socket_recv(struct cldap_socket *cldap) } req->asn1 = asn1; - talloc_steal(req, asn1.data); - req->asn1.ofs = 0; + talloc_steal(req, asn1->data); + req->asn1->ofs = 0; req->state = CLDAP_REQUEST_DONE; talloc_free(req->te); @@ -456,7 +456,7 @@ NTSTATUS cldap_search_recv(struct cldap_request *req, ldap_msg = talloc(mem_ctx, struct ldap_message); NT_STATUS_HAVE_NO_MEMORY(ldap_msg); - status = ldap_decode(&req->asn1, ldap_msg); + status = ldap_decode(req->asn1, ldap_msg); if (!NT_STATUS_IS_OK(status)) { DEBUG(2,("Failed to decode cldap search reply: %s\n", nt_errstr(status))); talloc_free(req); @@ -472,7 +472,7 @@ NTSTATUS cldap_search_recv(struct cldap_request *req, *io->out.response = ldap_msg->r.SearchResultEntry; /* decode the 2nd part */ - status = ldap_decode(&req->asn1, ldap_msg); + status = ldap_decode(req->asn1, ldap_msg); if (!NT_STATUS_IS_OK(status)) { DEBUG(2,("Failed to decode cldap search result entry: %s\n", nt_errstr(status))); talloc_free(req); diff --git a/source4/libcli/cldap/cldap.h b/source4/libcli/cldap/cldap.h index 928cf1f3e4..4b4be0d316 100644 --- a/source4/libcli/cldap/cldap.h +++ b/source4/libcli/cldap/cldap.h @@ -59,7 +59,7 @@ struct cldap_request { DATA_BLOB encoded; /* the reply data */ - struct asn1_data asn1; + struct asn1_data *asn1; /* information on what to do on completion */ struct { |