summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-03-25 17:58:19 +0100
committerStefan Metzmacher <metze@samba.org>2010-03-25 21:24:53 +0100
commitef1c3176c80a5d8533d590aacd0b5035ba589b17 (patch)
treed14837e2bb40138a18ac0266b18fcf2fff737795 /source4/libcli
parentc2a6631dc6a6ea61036f978ede083da3a98861c7 (diff)
downloadsamba-ef1c3176c80a5d8533d590aacd0b5035ba589b17.tar.gz
samba-ef1c3176c80a5d8533d590aacd0b5035ba589b17.tar.bz2
samba-ef1c3176c80a5d8533d590aacd0b5035ba589b17.zip
s4:libcli/wrepl: correctly remove the tstream_context when the connection is dead
metze
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/wrepl/winsrepl.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/source4/libcli/wrepl/winsrepl.c b/source4/libcli/wrepl/winsrepl.c
index 380c79a5ca..ec7e3798dc 100644
--- a/source4/libcli/wrepl/winsrepl.c
+++ b/source4/libcli/wrepl/winsrepl.c
@@ -413,6 +413,11 @@ static void wrepl_request_trigger(struct tevent_req *req,
struct wrepl_request_state);
struct tevent_req *subreq;
+ if (state->caller.wrepl_socket->stream == NULL) {
+ tevent_req_nterror(req, NT_STATUS_INVALID_CONNECTION);
+ return;
+ }
+
if (DEBUGLVL(10)) {
DEBUG(10,("Sending WINS packet of length %u\n",
(unsigned)state->req.blob.length));
@@ -445,10 +450,16 @@ static void wrepl_request_writev_done(struct tevent_req *subreq)
TALLOC_FREE(subreq);
if (ret == -1) {
NTSTATUS status = map_nt_error_from_unix(sys_errno);
+ TALLOC_FREE(state->caller.wrepl_socket->stream);
tevent_req_nterror(req, status);
return;
}
+ if (state->caller.wrepl_socket->stream == NULL) {
+ tevent_req_nterror(req, NT_STATUS_INVALID_CONNECTION);
+ return;
+ }
+
if (state->ctrl.disconnect_after_send) {
subreq = tstream_disconnect_send(state,
state->caller.ev,
@@ -490,12 +501,13 @@ static void wrepl_request_disconnect_done(struct tevent_req *subreq)
TALLOC_FREE(subreq);
if (ret == -1) {
NTSTATUS status = map_nt_error_from_unix(sys_errno);
+ TALLOC_FREE(state->caller.wrepl_socket->stream);
tevent_req_nterror(req, status);
return;
}
DEBUG(10,("WINS connection disconnected\n"));
- state->caller.wrepl_socket->stream = NULL;
+ TALLOC_FREE(state->caller.wrepl_socket->stream);
tevent_req_done(req);
}
@@ -512,6 +524,7 @@ static void wrepl_request_read_pdu_done(struct tevent_req *subreq)
status = tstream_read_pdu_blob_recv(subreq, state, &state->rep.blob);
if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(state->caller.wrepl_socket->stream);
tevent_req_nterror(req, status);
return;
}
@@ -554,6 +567,7 @@ NTSTATUS wrepl_request_recv(struct tevent_req *req,
NTSTATUS status;
if (tevent_req_is_nterror(req, &status)) {
+ TALLOC_FREE(state->caller.wrepl_socket->stream);
tevent_req_received(req);
return status;
}