From b6461a23ad87f13c97b9bbeaa5704ee1e3500874 Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Fri, 16 Oct 1998 12:03:01 +0000 Subject: Don't free nacked until we've finished looking at it (an alternative would be to save nacked->client in a variable). Do make sure to remove nacked from the list before calling client_deregister(), though. --- server/dispatch.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'server/dispatch.c') diff --git a/server/dispatch.c b/server/dispatch.c index 5659516..06d9461 100644 --- a/server/dispatch.c +++ b/server/dispatch.c @@ -692,15 +692,19 @@ rexmit(arg) if (rexmit_times[nacked->rexmits] == -1) { if (!nacked->client || NOW - nacked->client->last_ack >= CLIENT_GIVEUP_MIN) { - /* The client (if there was one) has been unresponsive. Give up - * sending this packet, and kill the client if there was one. */ + /* The client (if there was one) has been unresponsive. + * Give up sending this packet, and kill the client if + * there was one. (Make sure to remove nacked from the + * nack list before calling client_deregister(), which + * scans the nack list.) + */ LIST_DELETE(nacked); - free(nacked->packet); - free(nacked); if (nacked->client) { server_kill_clt(nacked->client); client_deregister(nacked->client, 1); } + free(nacked->packet); + free(nacked); return; } else { /* The client has sent us an ack recently. Retry with the maximum -- cgit v1.2.3