From 43d8cfdd73db7648c8067efad15808c68fd2f62e Mon Sep 17 00:00:00 2001 From: Karl Heyes Date: Thu, 6 Oct 2005 02:41:51 +0000 Subject: [PATCH] fix bug #717. a race on source exit could cause memory corruption svn path=/icecast/trunk/icecast/; revision=10135 --- src/client.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/client.c b/src/client.c index 3f361ea2..e4c31525 100644 --- a/src/client.c +++ b/src/client.c @@ -85,6 +85,14 @@ void client_destroy(client_t *client) if (client == NULL) return; + /* release the buffer now, as the buffer could be on the source queue + * and may of disappeared after auth completes */ + if (client->refbuf) + { + refbuf_release (client->refbuf); + client->refbuf = NULL; + } + if (release_client (client)) return; @@ -104,10 +112,6 @@ void client_destroy(client_t *client) stats_event_args (NULL, "clients", "%d", global.clients); global_unlock (); - /* drop ref counts if need be */ - if (client->refbuf) - refbuf_release (client->refbuf); - /* we need to free client specific format data (if any) */ if (client->free_client_data) client->free_client_data (client);