author | Florian Forster <octo@collectd.org> | |
Sat, 5 Dec 2015 21:06:46 +0000 (22:06 +0100) | ||
committer | Florian Forster <octo@collectd.org> | |
Sat, 5 Dec 2015 21:06:46 +0000 (22:06 +0100) |
15 files changed:
diff --git a/configure.ac b/configure.ac
index 2a9b84a9a5e13ed4daa19cdcfef5c4484c1de1fe..4acd193e10cb469f63a6c4fb7f07b94701f7d3e2 100644 (file)
--- a/configure.ac
+++ b/configure.ac
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])
diff --git a/src/aggregation.c b/src/aggregation.c
index 8175c66c18fb14ded8b5a4be282a9cf4e1a418c0..56e4955c247d3a4d8252d44e21b2f58d3e2be7bc 100644 (file)
--- a/src/aggregation.c
+++ b/src/aggregation.c
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); \
} \
diff --git a/src/bind.c b/src/bind.c
index 9fb3ec49e75ddda0756a4db1767bbec1e10a757b..dd49cb2220709ed8dc5b760928d21d013cdcb871 100644 (file)
--- a/src/bind.c
+++ b/src/bind.c
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);
diff --git a/src/curl_xml.c b/src/curl_xml.c
index 5a1f2baba232e7c56d5ed2ade5b8912e0f13ddd9..e83ac2d6797d95b4f8d1652a06e2bfe0347e6b2c 100644 (file)
--- a/src/curl_xml.c
+++ b/src/curl_xml.c
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, /* {{{ */
{
ERROR ("curl_xml plugin: invalid xpath. "
"xpath value can't be an empty string");
+ sfree (xpath);
return (-1);
}
if (db->list == NULL)
{
ERROR ("curl_xml plugin: list creation failed.");
+ sfree (xpath->path);
+ sfree (xpath);
return (-1);
}
}
if (name == NULL)
{
ERROR ("curl_xml plugin: strdup failed.");
+ sfree (xpath->path);
+ sfree (xpath);
return (-1);
}
if (le == NULL)
{
ERROR ("curl_xml plugin: llentry_create failed.");
+ sfree (xpath->path);
+ sfree (xpath);
return (-1);
}
index 3f7a596b1d6acae1b4ce6a4e82db7346a3ac78d3..e2c64261d34aa363aacb41c315fd152204397445 100644 (file)
--- a/src/daemon/utils_cache.c
+++ b/src/daemon/utils_cache.c
/ 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)
if (status != 0)
{
lcc_set_errno (c, status);
+ freeaddrinfo (ai_res);
return (-1);
}
+ freeaddrinfo (ai_res);
return (0);
} /* }}} int lcc_open_netsocket */
diff --git a/src/madwifi.c b/src/madwifi.c
index bb33b15d2c7818fe6cd3b623fd3fece4d1f47814..d0b2f83ea1afa0e429f3fe2646ddbfa2739b7d5d 100644 (file)
--- a/src/madwifi.c
+++ b/src/madwifi.c
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;
diff --git a/src/statsd.c b/src/statsd.c
index ea4123c10f6d38c6a731201981eb2aba7dff8d8c..d0a677e70476c79dc5fa0299c3da4af8292cdfd9 100644 (file)
--- a/src/statsd.c
+++ b/src/statsd.c
if (tmp == NULL)
{
ERROR ("statsd plugin: realloc failed.");
+ close (fd);
continue;
}
fds = tmp;
diff --git a/src/unixsock.c b/src/unixsock.c
index e6c75a65644e7441425183fb1b041c9bb93274c0..54a1e20d48aedf40a347bf901ff1718e518d00d5 100644 (file)
--- a/src/unixsock.c
+++ b/src/unixsock.c
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)
diff --git a/src/varnish.c b/src/varnish.c
index 95303bec9bb328c1e8b8c84e3437dd286472d047..aee72471a4d6b62d8e8d13266b47e8ff742b34a0 100644 (file)
--- a/src/varnish.c
+++ b/src/varnish.c
{
WARNING ("Varnish plugin: \"Instance\" blocks accept only "
"one argument.");
+ sfree (conf);
return (EINVAL);
}
WARNING ("Varnish plugin: No metric has been configured for "
"instance \"%s\". Disabling this instance.",
(conf->instance == NULL) ? "localhost" : conf->instance);
+ sfree (conf);
return (EINVAL);
}
diff --git a/src/write_riemann.c b/src/write_riemann.c
index 73d202c42fe8f228aaea46279dd12827a16d0371..5c59c92e4c50341c27fcb380188363685783d5d6 100644 (file)
--- a/src/write_riemann.c
+++ b/src/write_riemann.c
}
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);
diff --git a/src/write_sensu.c b/src/write_sensu.c
index 67c04969227302c4f7f81dc0bafa2016587bd32a..2336541b63594f33d750ecd3203b8b0e6024f8d4 100644 (file)
--- a/src/write_sensu.c
+++ b/src/write_sensu.c
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
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);
diff --git a/src/write_tsdb.c b/src/write_tsdb.c
index 4a626144f60498c2cd3a83fafba728c8b82b9b1b..2ed43890936d3699ba882c2b3d46c9dce33aacd7 100644 (file)
--- a/src/write_tsdb.c
+++ b/src/write_tsdb.c
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;
}
diff --git a/src/zfs_arc.c b/src/zfs_arc.c
index 2577bb017db900904894e6f5a6f1da53a6b4c1c8..41a89b16aef5348bb26a6d24a43fad50f316d5b7 100644 (file)
--- a/src/zfs_arc.c
+++ b/src/zfs_arc.c
{
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;
diff --git a/src/zookeeper.c b/src/zookeeper.c
index abdbf20f3361d257165d4697346e98213caeca11..539795c0321563ea8a1179a50470bc4dde28453a 100644 (file)
--- a/src/zookeeper.c
+++ b/src/zookeeper.c
}
buffer_fill += (size_t) status;
- if (status == 0)
- {
- /* done reading from the socket */
- break;
- }
} /* while (recv) */
status = 0;