Code

csv plugin: set datadir null when free
authorManuel Luis Sanmartin Rozada <manuel.luis@gmail.com>
Tue, 6 Aug 2013 10:30:52 +0000 (12:30 +0200)
committerManuel Luis Sanmartin Rozada <manuel.luis@gmail.com>
Tue, 6 Aug 2013 10:30:52 +0000 (12:30 +0200)
If you define twice DataDir:

    <Plugin csv>
DataDir "/opt/collectd/var/lib/collectd/csv"
DataDir stdout
    </Plugin>

the second time datadir will not be null and
you will get garbage in value_list_to_filename

src/csv.c

index f123c5d6dae1960d6fe91a53c16765d27eda4356..958e34baf0d96d825e8ce9dfa79a21849db6e3d2 100644 (file)
--- a/src/csv.c
+++ b/src/csv.c
@@ -215,7 +215,10 @@ static int csv_config (const char *key, const char *value)
        if (strcasecmp ("DataDir", key) == 0)
        {
                if (datadir != NULL)
+               {
                        free (datadir);
+                       datadir = NULL;
+               }
                if (strcasecmp ("stdout", value) == 0)
                {
                        use_stdio = 1;