write_sensu plugin: Unlock mutex before destroying it.
authorFlorian Forster <octo@collectd.org>
Mon, 20 Nov 2017 09:50:51 +0000 (10:50 +0100)
committerFlorian Forster <octo@collectd.org>
Mon, 20 Nov 2017 09:52:04 +0000 (10:52 +0100)
CID: 179237

src/write_sensu.c

index 72ed6bc..92f1743 100644 (file)
 
 #include "collectd.h"
 
+#include "common.h"
+#include "plugin.h"
+#include "utils_cache.h"
+
 #include <arpa/inet.h>
 #include <errno.h>
 #include <inttypes.h>
 #include <netdb.h>
 #include <stddef.h>
-#include "common.h"
-#include "plugin.h"
-#include "utils_cache.h"
 
 #include <stdlib.h>
 #define SENSU_HOST "localhost"
@@ -998,7 +999,10 @@ static void sensu_free(void *p) /* {{{ */
   sfree(host->separator);
   free_str_list(&(host->metric_handlers));
   free_str_list(&(host->notification_handlers));
+
+  pthread_mutex_unlock(&host->lock);
   pthread_mutex_destroy(&host->lock);
+
   sfree(host);
 } /* }}} void sensu_free */