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 c718621..07ffdda 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 2719093..8b0f867 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 019461a..9bb348f 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 46e13b3..88c38ac 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 8fc6f7d..ae3e798 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 3d36445..bfd2201 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 7b2f958..7621395 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 09d7137..336fbb9 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 49454f0..606b24d 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 08524fd..638e3a2 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 e2ccfee..f6af4fc 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)