svn commit: samba r23057 - in branches/SAMBA_4_0/source/libcli/raw: .

tridge at samba.org tridge at samba.org
Mon May 21 23:35:18 GMT 2007


Author: tridge
Date: 2007-05-21 23:35:14 +0000 (Mon, 21 May 2007)
New Revision: 23057

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23057

Log:

only call the async recv function for the first pending receive, not
all pending receives, when the transport dies. This is because the
async callback most commonly shuts down the connection (it's the only
reasonable thing to do when it's dead), and that frees the whole
context. That means that if we loop more than once, we'll end up using
freed memory.

Modified:
   branches/SAMBA_4_0/source/libcli/raw/clitransport.c


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/raw/clitransport.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/raw/clitransport.c	2007-05-21 23:33:26 UTC (rev 23056)
+++ branches/SAMBA_4_0/source/libcli/raw/clitransport.c	2007-05-21 23:35:14 UTC (rev 23057)
@@ -138,8 +138,11 @@
 		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;



More information about the samba-cvs mailing list