Merge branch 'collectd-5.7' into collectd-5.8
authorFlorian Forster <octo@collectd.org>
Sat, 18 Nov 2017 08:55:58 +0000 (09:55 +0100)
committerFlorian Forster <octo@collectd.org>
Sat, 18 Nov 2017 08:55:58 +0000 (09:55 +0100)
src/gps.c
src/snmp.c
src/write_riemann.c

index 210c293..ecb4bba 100644 (file)
--- a/src/gps.c
+++ b/src/gps.c
@@ -307,7 +307,6 @@ static int cgps_shutdown(void) {
   free(res);
 
   // Clean mutex:
-  pthread_mutex_unlock(&cgps_thread_lock);
   pthread_mutex_destroy(&cgps_thread_lock);
   pthread_mutex_unlock(&cgps_data_lock);
   pthread_mutex_destroy(&cgps_data_lock);
index 0a20e34..8cb866d 100644 (file)
@@ -1432,8 +1432,12 @@ static int csnmp_read_table(host_definition_t *host, data_definition_t *data) {
     for (vb = res->variables, i = 0; (vb != NULL);
          vb = vb->next_variable, i++) {
       /* Calculate value index from todo list */
-      while ((i < oid_list_len) && !oid_list_todo[i])
+      while ((i < oid_list_len) && !oid_list_todo[i]) {
         i++;
+      }
+      if (i >= oid_list_len) {
+        break;
+      }
 
       /* An instance is configured and the res variable we process is the
        * instance value (last index) */
index 6db3ef5..86f0c1f 100644 (file)
@@ -610,6 +610,7 @@ static void wrr_free(void *p) /* {{{ */
 
   wrr_disconnect(host);
 
+  pthread_mutex_lock(&host->lock);
   pthread_mutex_destroy(&host->lock);
   sfree(host);
 } /* }}} void wrr_free */