From 606af10d07ee0dbc8db8a7222a82bbfb5b85181e Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 11 May 2014 04:07:16 +0200 Subject: m + release all resources before re-execing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/mds-server/client.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/mds-server/client.c') diff --git a/src/mds-server/client.c b/src/mds-server/client.c index 08205b2..0e8e0b5 100644 --- a/src/mds-server/client.c +++ b/src/mds-server/client.c @@ -21,9 +21,32 @@ #include #include +#include +/** + * Release all resources assoicated with a client + * + * @param this The client information + */ +void client_destroy(client_t* restrict this) +{ + if (this->interception_conditions != NULL) + { + size_t i; + for (i = 0; i < this->interception_conditions_count; i++) + free(this->interception_conditions[i].condition); + free(this->interception_conditions); + } + if (this->mutex_created) + pthread_mutex_destroy(&(this->mutex)); + mds_message_destroy(&(this->message)); + free(this->send_pending); + free(this); +} + + /** * Calculate the buffer size need to marshal client information * -- cgit v1.2.3-70-g09d2