From c001b456cf0c9fdfd90a5239e3b86168d0fbb5aa Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 27 Jan 2009 19:41:34 +0100 Subject: [PATCH] Fix a valgrind error when the socket dies Don't reference anything that might have been deleted in the async_req_error call. --- source3/libsmb/async_smb.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c index a1fcf8eb0735..a4bbe6d79d59 100644 --- a/source3/libsmb/async_smb.c +++ b/source3/libsmb/async_smb.c @@ -1022,7 +1022,7 @@ static void cli_state_handler(struct event_context *event_ctx, struct fd_event *event, uint16 flags, void *p) { struct cli_state *cli = (struct cli_state *)p; - struct cli_request *req; + struct cli_request *req, *next; NTSTATUS status; DEBUG(11, ("cli_state_handler called with flags %d\n", flags)); @@ -1128,9 +1128,14 @@ static void cli_state_handler(struct event_context *event_ctx, return; sock_error: - for (req = cli->outstanding_requests; req; req = req->next) { - int i; - for (i=0; inum_async; i++) { + + for (req = cli->outstanding_requests; req; req = next) { + int i, num_async; + + next = req->next; + num_async = req->num_async; + + for (i=0; iasync[i], status); } } -- 2.34.1