X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fdaemon%2Futils_tail_match.c;h=1aeb814a08398ca961db75e33e87d6d38667dfd2;hb=d183dca833410ca9c035f2d09ff11d4410d50e43;hp=c8fd05ef7672e0c991c5e1ad04357f98730be63a;hpb=1ebf2f31bd2e080e6f42de640f0a3899a61501c0;p=collectd.git diff --git a/src/daemon/utils_tail_match.c b/src/daemon/utils_tail_match.c index c8fd05ef..1aeb814a 100644 --- a/src/daemon/utils_tail_match.c +++ b/src/daemon/utils_tail_match.c @@ -126,10 +126,9 @@ cu_tail_match_t *tail_match_create (const char *filename) { cu_tail_match_t *obj; - obj = malloc (sizeof (*obj)); + obj = calloc (1, sizeof (*obj)); if (obj == NULL) return (NULL); - memset (obj, '\0', sizeof (cu_tail_match_t)); obj->tail = cu_tail_create (filename); if (obj->tail == NULL) @@ -180,7 +179,7 @@ int tail_match_add_match (cu_tail_match_t *obj, cu_match_t *match, { cu_tail_match_match_t *temp; - temp = (cu_tail_match_match_t *) realloc (obj->matches, + temp = realloc (obj->matches, sizeof (cu_tail_match_match_t) * (obj->matches_num + 1)); if (temp == NULL) return (-1); @@ -212,13 +211,12 @@ int tail_match_add_match_simple (cu_tail_match_t *obj, if (match == NULL) return (-1); - user_data = malloc (sizeof (*user_data)); + user_data = calloc (1, sizeof (*user_data)); if (user_data == NULL) { match_destroy (match); return (-1); } - memset (user_data, '\0', sizeof (cu_tail_match_simple_t)); sstrncpy (user_data->plugin, plugin, sizeof (user_data->plugin)); if (plugin_instance != NULL)