summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-10-30 11:37:17 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:05:04 -0500
commit173dda6bf4db2faf29a1845ce2b1028105511dab (patch)
tree9a0140c99f6c2e336f1cc821a7bb66457df219f2 /source4/libcli
parentfeff2e9cbdd2e3e8e9db5d9b01b5d5cec42943c0 (diff)
downloadsamba-173dda6bf4db2faf29a1845ce2b1028105511dab.tar.gz
samba-173dda6bf4db2faf29a1845ce2b1028105511dab.tar.bz2
samba-173dda6bf4db2faf29a1845ce2b1028105511dab.zip
r3391: fixed some memory leaks in the schannel code
(This used to be commit eb3366d3667ddddf7ab5eae5d1fbc5de86c41072)
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/auth/schannel.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/source4/libcli/auth/schannel.c b/source4/libcli/auth/schannel.c
index a99822534b..2f20a3e906 100644
--- a/source4/libcli/auth/schannel.c
+++ b/source4/libcli/auth/schannel.c
@@ -23,7 +23,6 @@
#include "includes.h"
struct schannel_state {
- TALLOC_CTX *mem_ctx;
uint8_t session_key[16];
uint32_t seq_num;
BOOL initiator;
@@ -219,7 +218,7 @@ NTSTATUS schannel_seal_packet(struct schannel_state *state,
netsec_deal_with_seq_num(state, digest_final, seq_num);
- (*sig) = data_blob_talloc(state->mem_ctx, NULL, 32);
+ (*sig) = data_blob_talloc(mem_ctx, NULL, 32);
memcpy(sig->data, netsec_sig, 8);
memcpy(sig->data+8, seq_num, 8);
@@ -256,7 +255,7 @@ NTSTATUS schannel_sign_packet(struct schannel_state *state,
netsec_deal_with_seq_num(state, digest_final, seq_num);
- (*sig) = data_blob_talloc(state->mem_ctx, NULL, 32);
+ (*sig) = data_blob_talloc(mem_ctx, NULL, 32);
memcpy(sig->data, netsec_sig, 8);
memcpy(sig->data+8, seq_num, 8);
@@ -277,7 +276,7 @@ NTSTATUS schannel_sign_packet(struct schannel_state *state,
void schannel_end(struct schannel_state **state)
{
if (*state) {
- talloc_destroy((*state)->mem_ctx);
+ talloc_free(*state);
(*state) = NULL;
}
}
@@ -289,20 +288,11 @@ NTSTATUS schannel_start(struct schannel_state **state,
const uint8_t session_key[16],
BOOL initiator)
{
- TALLOC_CTX *mem_ctx;
-
- mem_ctx = talloc_init("schannel_state");
- if (!mem_ctx) {
- return NT_STATUS_NO_MEMORY;
- }
-
- (*state) = talloc_p(mem_ctx, struct schannel_state);
+ (*state) = talloc_p(NULL, struct schannel_state);
if (!(*state)) {
- talloc_destroy(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
- (*state)->mem_ctx = mem_ctx;
memcpy((*state)->session_key, session_key, 16);
(*state)->initiator = initiator;
(*state)->seq_num = 0;