X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fstatsd.c;h=54b6e943618d8f65b19c1a538a0cdf6758442814;hb=e0e307657d6b751d6beb5afb92c9359a6df7f5e8;hp=610391b1018bdfa04775d6f619bf78daa3a41ca5;hpb=f701e685eab83f37ecc6501d7dbe4eb941a454bb;p=collectd.git diff --git a/src/statsd.c b/src/statsd.c index 610391b1..54b6e943 100644 --- a/src/statsd.c +++ b/src/statsd.c @@ -562,6 +562,7 @@ static int statsd_network_init (struct pollfd **ret_fds, /* {{{ */ if (tmp == NULL) { ERROR ("statsd plugin: realloc failed."); + close (fd); continue; } fds = tmp; @@ -940,8 +941,6 @@ static int statsd_shutdown (void) /* {{{ */ void *key; void *value; - pthread_mutex_lock (&metrics_lock); - if (network_thread_running) { network_thread_shutdown = 1; @@ -950,6 +949,8 @@ static int statsd_shutdown (void) /* {{{ */ } network_thread_running = 0; + pthread_mutex_lock (&metrics_lock); + while (c_avl_pick (metrics_tree, &key, &value) == 0) { sfree (key);