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 #1710 from rpv-tomsk/perl-plugin-fixes
[collectd.git]
/
src
/
utils_fbhash.c
diff --git
a/src/utils_fbhash.c
b/src/utils_fbhash.c
index
70b8908
..
f27c082
100644
(file)
--- a/
src/utils_fbhash.c
+++ b/
src/utils_fbhash.c
@@
-41,7
+41,7
@@
struct fbhash_s
c_avl_tree_t *tree;
};
c_avl_tree_t *tree;
};
-/*
+/*
* Private functions
*/
static void fbh_free_tree (c_avl_tree_t *tree) /* {{{ */
* Private functions
*/
static void fbh_free_tree (c_avl_tree_t *tree) /* {{{ */
@@
-198,7
+198,7
@@
static int fbh_check_file (fbhash_t *h) /* {{{ */
return (status);
} /* }}} int fbh_check_file */
return (status);
} /* }}} int fbh_check_file */
-/*
+/*
* Public functions
*/
fbhash_t *fbh_create (const char *file) /* {{{ */
* Public functions
*/
fbhash_t *fbh_create (const char *file) /* {{{ */
@@
-209,10
+209,9
@@
fbhash_t *fbh_create (const char *file) /* {{{ */
if (file == NULL)
return (NULL);
if (file == NULL)
return (NULL);
- h =
malloc (
sizeof (*h));
+ h =
calloc (1,
sizeof (*h));
if (h == NULL)
return (NULL);
if (h == NULL)
return (NULL);
- memset (h, 0, sizeof (*h));
h->filename = strdup (file);
if (h->filename == NULL)
h->filename = strdup (file);
if (h->filename == NULL)
@@
-228,6
+227,7
@@
fbhash_t *fbh_create (const char *file) /* {{{ */
if (status != 0)
{
fbh_destroy (h);
if (status != 0)
{
fbh_destroy (h);
+ free (h);
return (NULL);
}
return (NULL);
}