Fix crash in async_smb.c
authorBo Yang <boyang@novell.com>
Wed, 4 Mar 2009 10:10:20 +0000 (18:10 +0800)
committerVolker Lendecke <vl@samba.org>
Fri, 20 Mar 2009 08:56:15 +0000 (09:56 +0100)
source3/libsmb/async_smb.c

index e579d1c9f0bcc32b7cdfda27ae2fbe6390f721ea..066ac7bdb8887478f02a389caf6b2daffe203ff0 100644 (file)
@@ -861,7 +861,7 @@ static NTSTATUS validate_smb_crypto(struct cli_state *cli, char *pdu)
 
 static void handle_incoming_pdu(struct cli_state *cli)
 {
-       struct cli_request *req;
+       struct cli_request *req, *next;
        uint16_t mid;
        size_t raw_pdu_len, buf_len, pdu_len, rest_len;
        char *pdu;
@@ -978,8 +978,11 @@ static void handle_incoming_pdu(struct cli_state *cli)
        DEBUG(10, ("handle_incoming_pdu: Aborting with %s\n",
                   nt_errstr(status)));
 
-       for (req = cli->outstanding_requests; req; req = req->next) {
-               async_req_nterror(req->async[0], status);
+       for (req = cli->outstanding_requests; req; req = next) {
+               next = req->next;
+               if (req->num_async) {
+                       async_req_nterror(req->async[0], status);
+               }
        }
        return;
 }