projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #1596 from rubenk/fix-a-few-more-prototypes
[collectd.git]
/
src
/
configfile.c
diff --git
a/src/configfile.c
b/src/configfile.c
index
c389ad1
..
8139c63
100644
(file)
--- a/
src/configfile.c
+++ b/
src/configfile.c
@@
-610,8
+610,11
@@
static int cf_include_all (oconfig_item_t *root, int depth)
return (-1);
/* Now replace the i'th child in `root' with `new'. */
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);
return (-1);
+ }
/* ... and go back to the new i'th child. */
--i;
/* ... and go back to the new i'th child. */
--i;
@@
-700,6
+703,7
@@
static oconfig_item_t *cf_read_dir (const char *dir,
if (root == NULL)
{
ERROR ("configfile: malloc failed.");
if (root == NULL)
{
ERROR ("configfile: malloc failed.");
+ closedir (dh);
return (NULL);
}
memset (root, 0, sizeof (oconfig_item_t));
return (NULL);
}
memset (root, 0, sizeof (oconfig_item_t));
@@
-719,6
+723,7
@@
static oconfig_item_t *cf_read_dir (const char *dir,
ERROR ("configfile: Not including `%s/%s' because its"
" name is too long.",
dir, de->d_name);
ERROR ("configfile: Not including `%s/%s' because its"
" name is too long.",
dir, de->d_name);
+ closedir (dh);
for (i = 0; i < filenames_num; ++i)
free (filenames[i]);
free (filenames);
for (i = 0; i < filenames_num; ++i)
free (filenames[i]);
free (filenames);
@@
-731,6
+736,7
@@
static oconfig_item_t *cf_read_dir (const char *dir,
filenames_num * sizeof (*filenames));
if (tmp == NULL) {
ERROR ("configfile: realloc failed.");
filenames_num * sizeof (*filenames));
if (tmp == NULL) {
ERROR ("configfile: realloc failed.");
+ closedir (dh);
for (i = 0; i < filenames_num - 1; ++i)
free (filenames[i]);
free (filenames);
for (i = 0; i < filenames_num - 1; ++i)
free (filenames[i]);
free (filenames);
@@
-743,7
+749,10
@@
static oconfig_item_t *cf_read_dir (const char *dir,
}
if (filenames == NULL)
}
if (filenames == NULL)
+ {
+ closedir (dh);
return (root);
return (root);
+ }
qsort ((void *) filenames, filenames_num, sizeof (*filenames),
cf_compare_string);
qsort ((void *) filenames, filenames_num, sizeof (*filenames),
cf_compare_string);
@@
-768,11
+777,12
@@
static oconfig_item_t *cf_read_dir (const char *dir,
free (name);
}
free (name);
}
+ closedir (dh);
free(filenames);
return (root);
} /* oconfig_item_t *cf_read_dir */
free(filenames);
return (root);
} /* oconfig_item_t *cf_read_dir */
-/*
+/*
* cf_read_generic
*
* Path is stat'ed and either cf_read_file or cf_read_dir is called
* cf_read_generic
*
* Path is stat'ed and either cf_read_file or cf_read_dir is called