X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fwrite_sensu.c;h=ddeecf83ef5aac283f8b88bc179a60f81a28e915;hb=072244d2e10336241610a1a0448a8149e9c77e7e;hp=ce23e654204a22f3fa4cc5e3f8aee4385976ae44;hpb=7f38ca96e3a54a4b02475f857c7d79c6a1257ada;p=collectd.git diff --git a/src/write_sensu.c b/src/write_sensu.c index ce23e654..ddeecf83 100644 --- a/src/write_sensu.c +++ b/src/write_sensu.c @@ -28,14 +28,15 @@ #include "collectd.h" +#include "common.h" +#include "plugin.h" +#include "utils_cache.h" + #include #include #include #include #include -#include "common.h" -#include "plugin.h" -#include "utils_cache.h" #include #define SENSU_HOST "localhost" @@ -879,11 +880,9 @@ static int sensu_send_msg(struct sensu_host *host, const char *msg) /* {{{ */ sensu_close_socket(host); if (status != 0) { - char errbuf[1024]; ERROR("write_sensu plugin: Sending to Sensu at %s:%s failed: %s", (host->node != NULL) ? host->node : SENSU_HOST, - (host->service != NULL) ? host->service : SENSU_PORT, - sstrerror(errno, errbuf, sizeof(errbuf))); + (host->service != NULL) ? host->service : SENSU_PORT, STRERRNO); return -1; } @@ -998,7 +997,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 */