summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/libcli/raw/clitransport.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c
index 8c4c7f7c43..ea2aa880b6 100644
--- a/source4/libcli/raw/clitransport.c
+++ b/source4/libcli/raw/clitransport.c
@@ -138,8 +138,11 @@ void smbcli_transport_dead(struct smbcli_transport *transport, NTSTATUS status)
status = NT_STATUS_UNEXPECTED_NETWORK_ERROR;
}
- /* kill all pending receives */
- while (transport->pending_recv) {
+ /* kill only the first pending receive - this is so that if
+ that async function frees the connection we don't die trying
+ to use old memory. The caller has to cope with only one
+ network error */
+ if (transport->pending_recv) {
struct smbcli_request *req = transport->pending_recv;
req->state = SMBCLI_REQUEST_ERROR;
req->status = status;