author | Marc Fournier <marc.fournier@camptocamp.com> | |
Sat, 1 Aug 2015 07:30:22 +0000 (09:30 +0200) | ||
committer | Marc Fournier <marc.fournier@camptocamp.com> | |
Sat, 1 Aug 2015 07:30:22 +0000 (09:30 +0200) |
diff --git a/src/Makefile.am b/src/Makefile.am
index c718621e974a0addd969705d85f484f50ec3b1b8..07ffdda9ce58ec20107893a4513bef2d144c2ce1 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
pkglib_LTLIBRARIES += amqp.la
amqp_la_SOURCES = amqp.c \
utils_cmd_putval.c utils_cmd_putval.h \
+ utils_parse_option.c utils_parse_option.h \
utils_format_graphite.c utils_format_graphite.h \
utils_format_json.c utils_format_json.h
amqp_la_LDFLAGS = $(PLUGIN_LDFLAGS) $(BUILD_WITH_LIBRABBITMQ_LDFLAGS)
diff --git a/src/collectd-nagios.c b/src/collectd-nagios.c
index 271909389cfcbf716cc5d1c2270a703bd2b29c04..8b0f867949e1f09c1b8f015598c8dd08e8d8925c 100644 (file)
--- a/src/collectd-nagios.c
+++ b/src/collectd-nagios.c
if ((hostname == NULL) || strcasecmp (hostname, ret_ident[i].host))
{
- if (hostname != NULL)
- free (hostname);
+ free (hostname);
hostname = strdup (ret_ident[i].host);
printf ("Host: %s\n", hostname);
}
printf ("ERROR: listval: Failed to convert returned "
"identifier to a string: %s\n",
lcc_strerror (connection));
+ free (hostname);
+ hostname = NULL;
continue;
}
printf ("\t%s\n", id + 1);
}
- if (ret_ident != NULL)
- free (ret_ident);
+ free (ret_ident);
+ free (hostname);
return (RET_OKAY);
} /* int do_listval */
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 019461abf253a95d6afe4ae760195c871126dd65..9bb348f71a1cad5500b28da2494bad6e30cd9e70 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
=head2 Plugin C<amqp>
-The I<AMQMP plugin> can be used to communicate with other instances of
+The I<AMQP plugin> can be used to communicate with other instances of
I<collectd> or third party applications using an AMQP message broker. Values
are sent to or received from the broker, which handles routing, queueing and
possibly filtering or messages.
diff --git a/src/daemon/collectd.c b/src/daemon/collectd.c
index 46e13b3f31256dd32e9accc1c54e2b1a47bd4426..88c38acea0990e1aa8684959c55ca9e8d94877e1 100644 (file)
--- a/src/daemon/collectd.c
+++ b/src/daemon/collectd.c
while ((dirlen > 0) && (dir[dirlen - 1] == '/'))
dir[--dirlen] = '\0';
- if (dirlen <= 0)
+ if (dirlen <= 0) {
+ free (dir);
return (-1);
+ }
status = chdir (dir);
if (status == 0)
index 8fc6f7d730222a5b8c34585ef701737ad056b4d1..ae3e79899d2eddf1304bcc00ba178289b3602d02 100644 (file)
--- a/src/daemon/configfile.c
+++ b/src/daemon/configfile.c
return (-1);
/* Now replace the i'th child in `root' with `new'. */
- if (cf_ci_replace_child (root, new, i) < 0)
+ if (cf_ci_replace_child (root, new, i) < 0) {
+ sfree (new->values);
+ sfree (new);
return (-1);
+ }
/* ... and go back to the new i'th child. */
--i;
diff --git a/src/daemon/plugin.c b/src/daemon/plugin.c
index 3d364458bfb4c3a3e0def36300e9a76d23cf88ee..bfd220171ea2bf8a07d08d9372d5ecc8ffbf3d0a 100644 (file)
--- a/src/daemon/plugin.c
+++ b/src/daemon/plugin.c
rf->rf_interval = plugin_get_interval ();
status = plugin_insert_read (rf);
- if (status != 0)
+ if (status != 0) {
+ sfree (rf->rf_name);
sfree (rf);
+ }
return (status);
} /* int plugin_register_read */
rf->rf_ctx = plugin_get_ctx ();
status = plugin_insert_read (rf);
- if (status != 0)
+ if (status != 0) {
+ sfree (rf->rf_name);
sfree (rf);
+ }
return (status);
} /* int plugin_register_complex_read */
return_status = -1;
}
+ sfree (rf->rf_name);
destroy_callback ((void *) rf);
}
index 7b2f95833576e4ab538e527b375e89ed122e27fd..76213955ca168dc17c9b01833b15fdd5afe3c517 100644 (file)
--- a/src/daemon/utils_cache.c
+++ b/src/daemon/utils_cache.c
/* This shouldn't happen. */
ERROR ("uc_insert: Don't know how to handle data source type %i.",
ds->ds[i].type);
+ sfree (key_copy);
return (-1);
} /* switch (ds->ds[i].type) */
} /* for (i) */
diff --git a/src/gmond.c b/src/gmond.c
index 09d713789f49402f1f8412486a56b9fd05c38ed0..336fbb9468b8eeb6c1002fc79dea02136829390d 100644 (file)
--- a/src/gmond.c
+++ b/src/gmond.c
}
} /* while (mc_receive_thread_loop != 0) */
+ free (mc_receive_socket_entries);
return ((void *) 0);
} /* }}} void *mc_receive_thread */
diff --git a/src/iptables.c b/src/iptables.c
index 49454f050d755283b5cec6094a003116983e21fb..606b24d9afdacfeda05ecd30a44f4976d674377a 100644 (file)
--- a/src/iptables.c
+++ b/src/iptables.c
char errbuf[1024];
ERROR ("realloc failed: %s",
sstrerror (errno, errbuf, sizeof (errbuf)));
+ sfree (temp.rule.comment);
return (1);
}
char errbuf[1024];
ERROR ("malloc failed: %s",
sstrerror (errno, errbuf, sizeof (errbuf)));
+ sfree (temp.rule.comment);
return (1);
}
memcpy (final, &temp, sizeof (temp));
index 08524fd84a4a775dd778c9eb1d873f7935739d11..638e3a232b3c688970194231b938c911a58b4186 100644 (file)
--- a/src/liboconfig/scanner.l
+++ b/src/liboconfig/scanner.l
*/
%{
-/* lex and yacc do some weird stuff, so turn off some warnings. */
-#if defined(__clang__)
-# pragma clang diagnostic ignored "-Wunused-function"
-# pragma clang diagnostic ignored "-Wunneeded-internal-declaration"
-#endif
-
#include <stdlib.h>
#include "oconfig.h"
#include "aux_types.h"
%}
%option yylineno
%option noyywrap
+%option noinput
+%option nounput
%x ML
WHITE_SPACE [\ \t\b]
NON_WHITE_SPACE [^\ \t\b]
diff --git a/src/memcached.c b/src/memcached.c
index e2ccfee6ae72ae006ed7f539a2f526161aaba7bc..f6af4fc77c2019e3152f26af5aa77ac4b43cc26d 100644 (file)
--- a/src/memcached.c
+++ b/src/memcached.c
sfree (st->socket);
sfree (st->host);
sfree (st->port);
+ sfree (st);
}
static int memcached_connect_unix (memcached_t *st)