routeros: fix a small build error pointed out by clang
routeros.c:334:35: error: 'memset' call operates on objects of type 'cr_data_t' (aka 'struct cr_data_s') while the size is based on a different type 'cr_data_t *' (aka 'struct cr_data_s *') [-Werror,-Wsizeof-pointer-memaccess]
memset (router_data, 0, sizeof (router_data));
~~~~~~~~~~~ ^~~~~~~~~~~
routeros.c:334:35: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?
memset (router_data, 0, sizeof (router_data));
^~~~~~~~~~~
routeros.c:334:35: error: 'memset' call operates on objects of type 'cr_data_t' (aka 'struct cr_data_s') while the size is based on a different type 'cr_data_t *' (aka 'struct cr_data_s *') [-Werror,-Wsizeof-pointer-memaccess]
memset (router_data, 0, sizeof (router_data));
~~~~~~~~~~~ ^~~~~~~~~~~
routeros.c:334:35: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)?
memset (router_data, 0, sizeof (router_data));
^~~~~~~~~~~
Revert "amqp: look for librabbitmq in /usr/local as well"
This reverts commit c1c5087fd5d9e66427cee8c98c523519d578bee6.
... as a follow-up to the discussion which took place in #1201
This reverts commit c1c5087fd5d9e66427cee8c98c523519d578bee6.
... as a follow-up to the discussion which took place in #1201
Fix libmodbus detection on FreeBSD
We look for modbus/modbus.h in /usr/local/include/modbus
but we should look for modbus.h
This is only an issue on FreeBSD since /usr/local/include is not
in the default search path.
We look for modbus/modbus.h in /usr/local/include/modbus
but we should look for modbus.h
This is only an issue on FreeBSD since /usr/local/include is not
in the default search path.
amqp: look for librabbitmq in /usr/local as well
This detects it automatically on FreeBSD.
Ideally we should just use pkg-config but that is
left as an exercise for the reader ;)
This detects it automatically on FreeBSD.
Ideally we should just use pkg-config but that is
left as an exercise for the reader ;)
irq: skip FIQ line in /proc/interrupts
/proc/interrupts on my Raspberry PI contains:
FIQ: usb_fiq
This line doesn't contain any per cpu counters
but we try to parse it anyway, resulting in:
parse_value: Failed to parse string as derive: usb_fiq.
Fixes #971
/proc/interrupts on my Raspberry PI contains:
FIQ: usb_fiq
This line doesn't contain any per cpu counters
but we try to parse it anyway, resulting in:
parse_value: Failed to parse string as derive: usb_fiq.
Fixes #971
Fix a memory leak on shutdown
Add utils_parse_option.c/h to amqp plugin source files list
collectd -T: fix memory leak
Fix some small leaks on error paths
liboconfig: really fix lex warnings
Flex has two options to disable input and unput.
Turn them on.
Flex has two options to disable input and unput.
Turn them on.
fix leak on exit
plugin.c: plug leak on error
memcached: plug leak
gmond: plug a small leak on exit
collectd.conf.pod: correct a tiny typo
Fix Perl errors
"my" variable $cmd masks earlier declaration in same scope at /tmp/contrib_collectd2html.pl line 223.
syntax error at /tmp/contrib_collectd2html.pl line 219, near "$span qw(1hour 1day 1week 1month)"
Global symbol "$span" requires explicit package name at /tmp/contrib_collectd2html.pl line 221.
Global symbol "$span" requires explicit package name at /tmp/contrib_collectd2html.pl line 224.
Global symbol "$span" requires explicit package name at /tmp/contrib_collectd2html.pl line 225.
Global symbol "$span" requires explicit package name at /tmp/contrib_collectd2html.pl line 232.
Global symbol "$span" requires explicit package name at /tmp/contrib_collectd2html.pl line 237.
syntax error at /tmp/contrib_collectd2html.pl line 245, near "}"
"my" variable $cmd masks earlier declaration in same scope at /tmp/contrib_collectd2html.pl line 223.
syntax error at /tmp/contrib_collectd2html.pl line 219, near "$span qw(1hour 1day 1week 1month)"
Global symbol "$span" requires explicit package name at /tmp/contrib_collectd2html.pl line 221.
Global symbol "$span" requires explicit package name at /tmp/contrib_collectd2html.pl line 224.
Global symbol "$span" requires explicit package name at /tmp/contrib_collectd2html.pl line 225.
Global symbol "$span" requires explicit package name at /tmp/contrib_collectd2html.pl line 232.
Global symbol "$span" requires explicit package name at /tmp/contrib_collectd2html.pl line 237.
syntax error at /tmp/contrib_collectd2html.pl line 245, near "}"
src/daemon/common.c: Fix off-by-one error in escape_slashes().
Partial cherry-pick of 0cba91923be9326224f8434e4aae7691f7b6dad1.
Partial cherry-pick of 0cba91923be9326224f8434e4aae7691f7b6dad1.
properly handle error cases when kvm_read fails (#1094)
don't report inodes if fs doesn't provide f_files and f_ffree
src/utils_cmd_flush.c: Fix memory leak.
src/utils_rrdcreate.c: Fix memory leak.
src/utils_ignorelist.c: Fix memory leak.
Turns out, regfree(3) cleans up the memory allocated by regcomp(3), but
not the pointer itself.
Turns out, regfree(3) cleans up the memory allocated by regcomp(3), but
not the pointer itself.
src/utils_cmd_putval.c: Fix memory leak.
utils_cache plugin: Fix memory leak.
rrdtool plugin: Add assertion.
This helps the static code analysis to figure out that memory is not
leaking after all.
This helps the static code analysis to figure out that memory is not
leaking after all.
powerdns plugin: Fix memory leak.
While at it, replace the powerdns_config_add_string() function.
While at it, replace the powerdns_config_add_string() function.
memcachec plugin: Fix memory leak.
java plugin: Fix memory leak.
ipvs plugin: Fix memory leak.
gmond plugin: Fix memory leak.
curl_xml plugin: Fix memory leak.
curl_json plugin: Fix memory leak.
curl plugin: Fix memory leak.
collectdmon: Fix memory leak.
apache plugin: Fix memory leak.
src/utils_cache.c: Fix two memory leaks.
* Free "times" pointer if it is not returned to the user.
* Free (re)alloc'ed pointers when strdup() fails.
* Free "times" pointer if it is not returned to the user.
* Free (re)alloc'ed pointers when strdup() fails.
snmp plugin: Fix "Assigned value is garbage or undefined" warning.
src/utils_latency.c: Fix "Assigned value is garbage or undefined" warning.
threshold plugin: Fix "Dead assignment" warnings.
stats plugin: Link with libm (-lm).
Fixes a bug reported by @Tenzer:
symbol lookup error: /usr/lib/collectd/statsd.so: undefined symbol: log
Fixes a bug reported by @Tenzer:
symbol lookup error: /usr/lib/collectd/statsd.so: undefined symbol: log
Fix "Undefined allocation of 0 bytes (CERT MEM04-C; CWE-131)" warnings.
threshold plugin: Fix "Dead increment" warnings.
Fix "Argument with 'nonnull' attribute passed null" warnings.
threshold plugin: Fix "Dead assignment" warning.
ted plugin: Fix "Dead assignment" warning.
tail_csv plugin: Fix "Dead assignment" warning.
tail plugin: Fix "Dead assignment" warning.
snmp plugin: Fix "Dead assignment" warning.
powerdns plugin: Fix "Dead assignment" warning.
ping plugin: Fix "Dead assignment" warning.
onewire plugin: Fix "Dead assignment" warning.
openvpn plugin: Fix "Dead assignment" warning.
ntpd plugin: Fix "Dead assignment" warning.
network plugin: Fix "Dead assignment" warning.
modbus plugin: Fix "Dead assignment" warning.
src/libcollectdclient/client.c: Fix "Dead assignment" warning.
gmond plugin: Fix handling of COUNTER and ABSOLUTE data sources.
email plugin: Fix "Dead assignment" warning.
src/daemon/filter_chain.c: Fix "Dead assignment" warning.
curl_json plugin: Fix "Dead assignment" warning.
amqp plugin: Fix "Dead assignment" warning.
src/utils_avltree.c: Add assertions to rotate_{left,right}().
clang's static code analysis thought that x->right / x->left could be NULL,
reporting false positives. Let's see if this fixes it.
clang's static code analysis thought that x->right / x->left could be NULL,
reporting false positives. Let's see if this fixes it.
snmp plugin: Fix off-by-one array access.
exec plugin: Don't assign variable that is never read.
src/utils_db_query.c: Fix use-after-free.
"r_area->next" was evaluated after "r_area" was freed.
"r_area->next" was evaluated after "r_area" was freed.
src/daemon/common.c: Implement strjoin() with memcpy().
The previous implementation used strncat() which has the unfortunate and
unintuitive behavior of copying n+1 bytes to the buffer.
The previous implementation used strncat() which has the unfortunate and
unintuitive behavior of copying n+1 bytes to the buffer.
src/utils_cache.c: Remove incorrect free.
"ce" is not updated / used in this loop, so it would be theoretically
possible for "ce" to be freed twice.
"ce" is not updated / used in this loop, so it would be theoretically
possible for "ce" to be freed twice.
network plugin: Avoid "status may be used uninitialized" warning.
liboconfig: Declare yylex().
email plugin: Fix freeing linked lists.
The previous code essentially did:
for (…; …; ptr = ptr->next)
free (ptr);
The "ptr->next" is a use-after-free.
The previous code essentially did:
for (…; …; ptr = ptr->next)
free (ptr);
The "ptr->next" is a use-after-free.
network plugin: Make sure all memory is freed when the receive thread fails.
Not all that useful (your receive thread just died …) but hopefully
makes the static analysis happy.
Not all that useful (your receive thread just died …) but hopefully
makes the static analysis happy.
Merge remote-tracking branch 'github/pr/1088' into collectd-5.4
src/utils_llist.c: Handle unlikely corner case.
This handles the following (unlikely) case:
(l->head == NULL) && (e == NULL)
In this case, the following code will dereference a NULL pointer:
if (l->head == e)
l->head = e->next;
This handles the following (unlikely) case:
(l->head == NULL) && (e == NULL)
In this case, the following code will dereference a NULL pointer:
if (l->head == e)
l->head = e->next;
src/utils_avltree.c: Rewrite checks in c_avl_pick().
The previous code made the (correct) assumption that "height" is always
greater than zero. This tripped up clang's "scan-build".
This confuses the static analysis in two more places in this file, which
are not as easy to fix :(
The previous code made the (correct) assumption that "height" is always
greater than zero. This tripped up clang's "scan-build".
This confuses the static analysis in two more places in this file, which
are not as easy to fix :(
network plugin: Explicitly initialize "fd_num" to zero.
I have the feeling that initialization via memset() and unions in the sockent
structure confuse clang's scan-build.
I have the feeling that initialization via memset() and unions in the sockent
structure confuse clang's scan-build.
notification target: Pass void** to tn_destroy().
The previous call was bad, resulting in errors in free().
The previous call was bad, resulting in errors in free().
perl plugin: Fix invalid free().
notification_meta_t.name is a char[], which we must not free.
notification_meta_t.name is a char[], which we must not free.
liboconfig: Disable some clang warnings.
Hopefully fixes:
scanner.c:4128:17: error: unused function 'yyunput' [-Werror,-Wunused-function]
static void yyunput (int c, register char * yy_bp )
^
scanner.c:4173:16: error: function 'input' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
static int input (void)
^
2 errors generated.
Hopefully fixes:
scanner.c:4128:17: error: unused function 'yyunput' [-Werror,-Wunused-function]
static void yyunput (int c, register char * yy_bp )
^
scanner.c:4173:16: error: function 'input' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
static int input (void)
^
2 errors generated.
liboconfig: Declare yyparse().
Should hopefully fix:
oconfig.c:68:12: error: implicit declaration of function 'yyparse' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
status = yyparse ();
^
Should hopefully fix:
oconfig.c:68:12: error: implicit declaration of function 'yyparse' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
status = yyparse ();
^
In rrd synchronous file creation use lock_file
to prevent the creation of the same file at the same time multiple times
and obtain a corrupt rrd file.
to prevent the creation of the same file at the same time multiple times
and obtain a corrupt rrd file.
Allow empty Plugin blocks.
Corrected text in README
collectd.conf.pod: update libyajl URL
Fixes #1081
Thanks to @msalmonse for pointing this out!
Fixes #1081
Thanks to @msalmonse for pointing this out!
Fix a libtool warning
libtool: warning: '-version-info/-version-number' is ignored for
convenience libraries
libtool: warning: '-version-info/-version-number' is ignored for
convenience libraries
write_redis plugin: Check the return value of format_values().
write_redis: Increase parsability by using format_values from common.h
write_redis: Increase parsability of multi-valued keys by insterting delimiting characters
configure.ac: Move all checks for "struct ip6_ext" into one place.
Fixes: #348
Fixes: #348
Automatically add -DSOLARIS2=8 if required for ip6_ext
Fixes: #348
Fixes: #348
dns plugin: Check for "struct ip6_ext".
Solaris appears to declare the struct, but only when The Right defines
are specified at compile time. As a quick and dirty fix, only build with
IPv6 support when the struct is usable.
Fixes: #348
Solaris appears to declare the struct, but only when The Right defines
are specified at compile time. As a quick and dirty fix, only build with
IPv6 support when the struct is usable.
Fixes: #348
vmem plugin: fix types for nr_dirtied and nr_written
tcpconns plugin: Fix memory leak.
"prev" was set to NULL and never updated, leading to "port_list_head" to
be set to an entry later in the list. This leaks memory because earlier
entries in the list are now unreachable.
Fixes: #1074
"prev" was set to NULL and never updated, leading to "port_list_head" to
be set to an entry later in the list. This leaks memory because earlier
entries in the list are now unreachable.
Fixes: #1074
src/configfile.c: Set a plugin context when autoloading plugins.
Fixes: #1069
Fixes: #1069
statsd plugin: Dispatch NaN when no timer event was recorded.
This makes timing events appear faster when writing to RRD files.
Fixes: #1038, #1049
This makes timing events appear faster when writing to RRD files.
Fixes: #1038, #1049
tail_csv plugin: Print warning and continue when metric is not found.
Previously, when multiple metrics were specified on one "Collect" line and one
didn't exist, all *following* metrics would be ignored. This patch changes this
to continue in this case and configure as many metrics as possible.
Previously, when multiple metrics were specified on one "Collect" line and one
didn't exist, all *following* metrics would be ignored. This patch changes this
to continue in this case and configure as many metrics as possible.
Plugin tail_csv: the manual says that you can use multiple times the
Collect option but the code expecs t"Collect n1 n2 n3 n4", fix
to allow to put the option Collect multiple times.
Collect option but the code expecs t"Collect n1 n2 n3 n4", fix
to allow to put the option Collect multiple times.
Plugin tail_csv: if TimeFrom is not specified in config file
the default value for time_from is -1 and the type of fileds_num
is size_t, so the comparsion of signed and unsigned not work as espected
the default value for time_from is -1 and the type of fileds_num
is size_t, so the comparsion of signed and unsigned not work as espected
stats plugin: Fix reference of undeclared symbol.
Issue: #997
Issue: #997
statsd plugin: Free latency counter and AVL trees.
latency counters (used by TIMER metrics) and AVL trees (used by SET metrics)
were not freed when cleaning up unused metrics. This resulted in leaked memory.
Fixes: #997
latency counters (used by TIMER metrics) and AVL trees (used by SET metrics)
were not freed when cleaning up unused metrics. This resulted in leaked memory.
Fixes: #997