X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fdaemon%2Futils_match.c;h=cf87b6b7782b7bc5aa461163d6adeed4f1285f9e;hb=9f19d00282cf8623e0233ef539649358a5b5803e;hp=c1d99e15aa4f81e413ec7bc852cef630f463a721;hpb=1ebf2f31bd2e080e6f42de640f0a3899a61501c0;p=collectd.git diff --git a/src/daemon/utils_match.c b/src/daemon/utils_match.c index c1d99e15..cf87b6b7 100644 --- a/src/daemon/utils_match.c +++ b/src/daemon/utils_match.c @@ -238,10 +238,9 @@ cu_match_t *match_create_callback (const char *regex, const char *excluderegex, DEBUG ("utils_match: match_create_callback: regex = %s, excluderegex = %s", regex, excluderegex); - obj = malloc (sizeof (*obj)); + obj = calloc (1, sizeof (*obj)); if (obj == NULL) return (NULL); - memset (obj, '\0', sizeof (cu_match_t)); status = regcomp (&obj->regex, regex, REG_EXTENDED | REG_NEWLINE); if (status != 0) @@ -275,10 +274,9 @@ cu_match_t *match_create_simple (const char *regex, cu_match_value_t *user_data; cu_match_t *obj; - user_data = malloc (sizeof (*user_data)); + user_data = calloc (1, sizeof (*user_data)); if (user_data == NULL) return (NULL); - memset (user_data, '\0', sizeof (cu_match_value_t)); user_data->ds_type = match_ds_type; obj = match_create_callback (regex, excluderegex,