Code

Merge branch 'collectd-5.5'
authorFlorian Forster <octo@collectd.org>
Sat, 5 Dec 2015 21:06:46 +0000 (22:06 +0100)
committerFlorian Forster <octo@collectd.org>
Sat, 5 Dec 2015 21:06:46 +0000 (22:06 +0100)
15 files changed:
configure.ac
src/aggregation.c
src/bind.c
src/curl_xml.c
src/daemon/utils_cache.c
src/libcollectdclient/client.c
src/madwifi.c
src/statsd.c
src/unixsock.c
src/varnish.c
src/write_riemann.c
src/write_sensu.c
src/write_tsdb.c
src/zfs_arc.c
src/zookeeper.c

index 2a9b84a9a5e13ed4daa19cdcfef5c4484c1de1fe..4acd193e10cb469f63a6c4fb7f07b94701f7d3e2 100644 (file)
@@ -2227,7 +2227,7 @@ then
                fi
 
                AC_MSG_CHECKING([for libjvm.so])
-               TMPVAR=`find -L "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
+               TMPVAR=`find -L "$with_java_home" -type f -name libjvm.so -o -name libjvm.dylib -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
                if test "x$TMPVAR" != "x"
                then
                        AC_MSG_RESULT([found in $TMPVAR])
index 8175c66c18fb14ded8b5a4be282a9cf4e1a418c0..56e4955c247d3a4d8252d44e21b2f58d3e2be7bc 100644 (file)
@@ -262,6 +262,7 @@ static agg_instance_t *agg_instance_create (data_set_t const *ds, /* {{{ */
     inst->state_ ## field = malloc (sizeof (*inst->state_ ## field)); \
     if (inst->state_ ## field == NULL) { \
       agg_instance_destroy (inst); \
+      free (inst); \
       ERROR ("aggregation plugin: malloc() failed."); \
       return (NULL); \
     } \
index 9fb3ec49e75ddda0756a4db1767bbec1e10a757b..dd49cb2220709ed8dc5b760928d21d013cdcb871 100644 (file)
@@ -1709,6 +1709,7 @@ static int bind_config (oconfig_item_t *ci) /* {{{ */
         return (-1);
       }
 
+      sfree (url);
       url = strdup (child->values[0].value.string);
     } else if (strcasecmp ("OpCodes", child->key) == 0)
       bind_config_set_bool ("OpCodes", &global_opcodes, child);
index 5a1f2baba232e7c56d5ed2ade5b8912e0f13ddd9..e83ac2d6797d95b4f8d1652a06e2bfe0347e6b2c 100644 (file)
@@ -698,7 +698,7 @@ static int cx_config_add_values (const char *name, cx_xpath_t *xpath, /* {{{ */
     sstrncpy (xpath->values[i].path, ci->values[i].value.string, sizeof (xpath->values[i].path));
   }
 
-  return (0); 
+  return (0);
 } /* }}} cx_config_add_values */
 
 static int cx_config_add_xpath (cx_t *db, /* {{{ */
@@ -728,6 +728,7 @@ static int cx_config_add_xpath (cx_t *db, /* {{{ */
   {
     ERROR ("curl_xml plugin: invalid xpath. "
            "xpath value can't be an empty string");
+    sfree (xpath);
     return (-1);
   }
 
@@ -771,6 +772,8 @@ static int cx_config_add_xpath (cx_t *db, /* {{{ */
       if (db->list == NULL)
       {
         ERROR ("curl_xml plugin: list creation failed.");
+        sfree (xpath->path);
+        sfree (xpath);
         return (-1);
       }
     }
@@ -779,6 +782,8 @@ static int cx_config_add_xpath (cx_t *db, /* {{{ */
     if (name == NULL)
     {
         ERROR ("curl_xml plugin: strdup failed.");
+        sfree (xpath->path);
+        sfree (xpath);
         return (-1);
     }
 
@@ -786,6 +791,8 @@ static int cx_config_add_xpath (cx_t *db, /* {{{ */
     if (le == NULL)
     {
       ERROR ("curl_xml plugin: llentry_create failed.");
+      sfree (xpath->path);
+      sfree (xpath);
       return (-1);
     }
 
index 3f7a596b1d6acae1b4ce6a4e82db7346a3ac78d3..e2c64261d34aa363aacb41c315fd152204397445 100644 (file)
@@ -193,12 +193,13 @@ static int uc_insert (const data_set_t *ds, const value_list_t *vl,
            / CDTIME_T_TO_DOUBLE (vl->interval);
        ce->values_raw[i].absolute = vl->values[i].absolute;
        break;
-       
+
       default:
        /* This shouldn't happen. */
        ERROR ("uc_insert: Don't know how to handle data source type %i.",
            ds->ds[i].type);
        sfree (key_copy);
+       cache_free (ce);
        return (-1);
     } /* switch (ds->ds[i].type) */
   } /* for (i) */
index eaee9c0f7cb0f411d199a1cfc8051212fe15fa84..77819c217b6e8ae1272415974f88480ab17710b0 100644 (file)
@@ -526,9 +526,11 @@ static int lcc_open_netsocket (lcc_connection_t *c, /* {{{ */
   if (status != 0)
   {
     lcc_set_errno (c, status);
+    freeaddrinfo (ai_res);
     return (-1);
   }
 
+  freeaddrinfo (ai_res);
   return (0);
 } /* }}} int lcc_open_netsocket */
 
index bb33b15d2c7818fe6cd3b623fd3fece4d1f47814..d0b2f83ea1afa0e429f3fe2646ddbfa2739b7d5d 100644 (file)
@@ -821,15 +821,16 @@ check_devname (const char *dev)
 
        if (dev[0] == '.')
                return 0;
-       
+
        ssnprintf (buf, sizeof (buf), "/sys/class/net/%s/device/driver", dev);
-       buf[sizeof (buf) - 1] = 0;
+       buf[sizeof (buf) - 1] = '\0';
 
-       memset (buf2, 0, sizeof (buf2));
        i = readlink (buf, buf2, sizeof (buf2) - 1);
        if (i < 0)
                return 0;
 
+       buf2[i] = '\0';
+
        if (strstr (buf2, "/drivers/ath_") == NULL)
                return 0;
        return 1;
index ea4123c10f6d38c6a731201981eb2aba7dff8d8c..d0a677e70476c79dc5fa0299c3da4af8292cdfd9 100644 (file)
@@ -565,6 +565,7 @@ static int statsd_network_init (struct pollfd **ret_fds, /* {{{ */
     if (tmp == NULL)
     {
       ERROR ("statsd plugin: realloc failed.");
+      close (fd);
       continue;
     }
     fds = tmp;
index e6c75a65644e7441425183fb1b041c9bb93274c0..54a1e20d48aedf40a347bf901ff1718e518d00d5 100644 (file)
@@ -127,7 +127,16 @@ static int us_open_socket (void)
                return (-1);
        }
 
-       chmod (sa.sun_path, sock_perms);
+       status = chmod (sa.sun_path, sock_perms);
+       if (status == -1)
+       {
+               char errbuf[1024];
+               ERROR ("unixsock plugin: chmod failed: %s",
+                               sstrerror (errno, errbuf, sizeof (errbuf)));
+               close (sock_fd);
+               sock_fd = -1;
+               return (-1);
+       }
 
        status = listen (sock_fd, 8);
        if (status != 0)
index 95303bec9bb328c1e8b8c84e3437dd286472d047..aee72471a4d6b62d8e8d13266b47e8ff742b34a0 100644 (file)
@@ -1002,6 +1002,7 @@ static int varnish_config_instance (const oconfig_item_t *ci) /* {{{ */
        {
                WARNING ("Varnish plugin: \"Instance\" blocks accept only "
                                "one argument.");
+               sfree (conf);
                return (EINVAL);
        }
 
@@ -1109,6 +1110,7 @@ static int varnish_config_instance (const oconfig_item_t *ci) /* {{{ */
                WARNING ("Varnish plugin: No metric has been configured for "
                                "instance \"%s\". Disabling this instance.",
                                (conf->instance == NULL) ? "localhost" : conf->instance);
+               sfree (conf);
                return (EINVAL);
        }
 
index 73d202c42fe8f228aaea46279dd12827a16d0371..5c59c92e4c50341c27fcb380188363685783d5d6 100644 (file)
@@ -1050,6 +1050,7 @@ static int riemann_config(oconfig_item_t *ci) /* {{{ */
                        }
                        if ((val = strdup(child->values[1].value.string)) == NULL) {
                                WARNING("cannot allocate memory for attribute value.");
+                               sfree (key);
                                return (-1);
                        }
                        strarray_add(&riemann_attrs, &riemann_attrs_num, key);
index 67c04969227302c4f7f81dc0bafa2016587bd32a..2336541b63594f33d750ecd3203b8b0e6024f8d4 100644 (file)
@@ -679,6 +679,7 @@ static char *sensu_notification_to_json(struct sensu_host *host, /* {{{ */
        char *handlers_str = build_json_str_list("handlers", &(host->notification_handlers));
        if (handlers_str == NULL) {
                ERROR("write_sensu plugin: Unable to alloc memory");
+               free(ret_str);
                return NULL;
        }
        // incorporate the handlers
@@ -780,6 +781,7 @@ static char *sensu_notification_to_json(struct sensu_host *host, /* {{{ */
                char *msg = replace_json_reserved(n->message);
                if (msg == NULL) {
                        ERROR("write_sensu plugin: Unable to alloc memory");
+                       free(ret_str);
                        return NULL;
                }
                res = asprintf(&temp_str, "%s, \"output\": \"%s - %s\"", ret_str, severity, msg);
index 4a626144f60498c2cd3a83fafba728c8b82b9b1b..2ed43890936d3699ba882c2b3d46c9dce33aacd7 100644 (file)
@@ -211,7 +211,6 @@ static int wt_callback_init(struct wt_callback *cb)
         ERROR("write_tsdb plugin: Connecting to %s:%s failed. "
               "The last error was: %s", node, service,
               sstrerror (errno, errbuf, sizeof(errbuf)));
-        close(cb->sock_fd);
         return -1;
     }
 
index 2577bb017db900904894e6f5a6f1da53a6b4c1c8..41a89b16aef5348bb26a6d24a43fad50f316d5b7 100644 (file)
@@ -208,6 +208,11 @@ static int za_read (void)
                {
                        llentry_t *e;
                        llvalues = malloc(sizeof(long long int) * i);
+                       if (llvalues == NULL)
+                       {
+                               ERROR ("zfs_arc plugin: `malloc' failed.");
+                               return (-1);
+                       }
                        int j = 0;
 
                        pnl = file_contents;
index abdbf20f3361d257165d4697346e98213caeca11..539795c0321563ea8a1179a50470bc4dde28453a 100644 (file)
@@ -198,11 +198,6 @@ static int zookeeper_query (char *buffer, size_t buffer_size)
                }
 
                buffer_fill += (size_t) status;
-               if (status == 0)
-               {
-                       /* done reading from the socket */
-                       break;
-               }
        } /* while (recv) */
 
        status = 0;