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);