Code

Merge branch 'collectd-5.4' into collectd-5.5
authorMarc Fournier <marc.fournier@camptocamp.com>
Sat, 1 Aug 2015 07:30:22 +0000 (09:30 +0200)
committerMarc Fournier <marc.fournier@camptocamp.com>
Sat, 1 Aug 2015 07:30:22 +0000 (09:30 +0200)
src/Makefile.am
src/collectd-nagios.c
src/collectd.conf.pod
src/daemon/collectd.c
src/daemon/configfile.c
src/daemon/plugin.c
src/daemon/utils_cache.c
src/gmond.c
src/iptables.c
src/liboconfig/scanner.l
src/memcached.c

index c718621e974a0addd969705d85f484f50ec3b1b8..07ffdda9ce58ec20107893a4513bef2d144c2ce1 100644 (file)
@@ -99,6 +99,7 @@ if BUILD_PLUGIN_AMQP
 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)
index 271909389cfcbf716cc5d1c2270a703bd2b29c04..8b0f867949e1f09c1b8f015598c8dd08e8d8925c 100644 (file)
@@ -308,8 +308,7 @@ static int do_listval (lcc_connection_t *connection)
 
                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);
                }
@@ -323,6 +322,8 @@ static int do_listval (lcc_connection_t *connection)
                        printf ("ERROR: listval: Failed to convert returned "
                                        "identifier to a string: %s\n",
                                        lcc_strerror (connection));
+                       free (hostname);
+                       hostname = NULL;
                        continue;
                }
 
@@ -330,8 +331,8 @@ static int do_listval (lcc_connection_t *connection)
                printf ("\t%s\n", id + 1);
        }
 
-       if (ret_ident != NULL)
-               free (ret_ident);
+       free (ret_ident);
+       free (hostname);
        return (RET_OKAY);
 } /* int do_listval */
 
index 019461abf253a95d6afe4ae760195c871126dd65..9bb348f71a1cad5500b28da2494bad6e30cd9e70 100644 (file)
@@ -501,7 +501,7 @@ are disabled by default.
 
 =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.
index 46e13b3f31256dd32e9accc1c54e2b1a47bd4426..88c38acea0990e1aa8684959c55ca9e8d94877e1 100644 (file)
@@ -197,8 +197,10 @@ static int change_basedir (const char *orig_dir)
        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)
@@ -623,8 +623,11 @@ static int cf_include_all (oconfig_item_t *root, int depth)
                        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;
index 3d364458bfb4c3a3e0def36300e9a76d23cf88ee..bfd220171ea2bf8a07d08d9372d5ecc8ffbf3d0a 100644 (file)
@@ -1237,8 +1237,10 @@ int plugin_register_read (const char *name,
        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 */
@@ -1285,8 +1287,10 @@ int plugin_register_complex_read (const char *group, const char *name,
        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 */
@@ -1720,6 +1724,7 @@ int plugin_read_all_once (void)
                        return_status = -1;
                }
 
+               sfree (rf->rf_name);
                destroy_callback ((void *) rf);
        }
 
index 7b2f95833576e4ab538e527b375e89ed122e27fd..76213955ca168dc17c9b01833b15fdd5afe3c517 100644 (file)
@@ -198,6 +198,7 @@ static int uc_insert (const data_set_t *ds, const value_list_t *vl,
        /* 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) */
index 09d713789f49402f1f8412486a56b9fd05c38ed0..336fbb9468b8eeb6c1002fc79dea02136829390d 100644 (file)
@@ -875,6 +875,7 @@ static void *mc_receive_thread (void *arg) /* {{{ */
     }
   } /* while (mc_receive_thread_loop != 0) */
 
+  free (mc_receive_socket_entries);
   return ((void *) 0);
 } /* }}} void *mc_receive_thread */
 
index 49454f050d755283b5cec6094a003116983e21fb..606b24d9afdacfeda05ecd30a44f4976d674377a 100644 (file)
@@ -213,6 +213,7 @@ static int iptables_config (const char *key, const char *value)
                    char errbuf[1024];
                    ERROR ("realloc failed: %s",
                            sstrerror (errno, errbuf, sizeof (errbuf)));
+                   sfree (temp.rule.comment);
                    return (1);
                }
 
@@ -223,6 +224,7 @@ static int iptables_config (const char *key, const char *value)
                    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)
  */
 
 %{
-/* 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"
@@ -56,6 +50,8 @@ static void ml_append (char *);
 %}
 %option yylineno
 %option noyywrap
+%option noinput
+%option nounput
 %x ML
 WHITE_SPACE [\ \t\b]
 NON_WHITE_SPACE [^\ \t\b]
index e2ccfee6ae72ae006ed7f539a2f526161aaba7bc..f6af4fc77c2019e3152f26af5aa77ac4b43cc26d 100644 (file)
@@ -62,6 +62,7 @@ static void memcached_free (memcached_t *st)
   sfree (st->socket);
   sfree (st->host);
   sfree (st->port);
+  sfree (st);
 }
 
 static int memcached_connect_unix (memcached_t *st)