summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 24667b8)
raw | patch | inline | side by side (parent: 24667b8)
author | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Sat, 25 Jul 2015 17:17:07 +0000 (19:17 +0200) | ||
committer | Marc Fournier <marc.fournier@camptocamp.com> | |
Sat, 1 Aug 2015 07:11:49 +0000 (09:11 +0200) |
diff --git a/src/collectd-nagios.c b/src/collectd-nagios.c
index e31d95ca31f3e52ebd2923e0482b3e7f7973f294..7fda6fc120a3aa4c94eaa640092ab2ff39724f40 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.c b/src/collectd.c
index 6815cccfd80f2af49e34f6215db737dcac9543ea..1ccc1c08e1eca87d4975351d1764fe2116c38031 100644 (file)
--- a/src/collectd.c
+++ b/src/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)
diff --git a/src/configfile.c b/src/configfile.c
index c389ad1676a3d2948dd806da979ac5f1ee9f88c5..32629e08095cb6849d6d681ca19fc1b918d6e7bb 100644 (file)
--- a/src/configfile.c
+++ b/src/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/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));
diff --git a/src/utils_cache.c b/src/utils_cache.c
index 7eae1c7ed5121e6cb01f15f10336392911ade236..910e30b29cbec6d99974eae30bb0f9418bb80a16 100644 (file)
--- a/src/utils_cache.c
+++ b/src/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) */