aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-server/client.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-05-11 04:07:16 +0200
committerMattias Andrée <maandree@operamail.com>2014-05-11 04:07:16 +0200
commit606af10d07ee0dbc8db8a7222a82bbfb5b85181e (patch)
tree95e0c643701c75592e0f08f3d624f67e5e59d1c4 /src/mds-server/client.c
parentmove mutex_created into client_t + error handling for pthread_*_init (diff)
downloadmds-606af10d07ee0dbc8db8a7222a82bbfb5b85181e.tar.gz
mds-606af10d07ee0dbc8db8a7222a82bbfb5b85181e.tar.bz2
mds-606af10d07ee0dbc8db8a7222a82bbfb5b85181e.tar.xz
m + release all resources before re-execing
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/mds-server/client.c23
1 files changed, 23 insertions, 0 deletions
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,10 +21,33 @@
#include <stdlib.h>
#include <string.h>
+#include <pthread.h>
/**
+ * 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
*
* @param this The client information