projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
all plugins: remove pthread.h include
[collectd.git]
/
src
/
match_regex.c
diff --git
a/src/match_regex.c
b/src/match_regex.c
index
7429ffa
..
bbc35cd
100644
(file)
--- a/
src/match_regex.c
+++ b/
src/match_regex.c
@@
-140,13
+140,12
@@
static int mr_config_add_regex (mr_regex_t **re_head, /* {{{ */
return (-1);
}
return (-1);
}
- re =
malloc (
sizeof (*re));
+ re =
calloc (1,
sizeof (*re));
if (re == NULL)
{
if (re == NULL)
{
- log_err ("mr_config_add_regex:
m
alloc failed.");
+ log_err ("mr_config_add_regex:
c
alloc failed.");
return (-1);
}
return (-1);
}
- memset (re, 0, sizeof (*re));
re->next = NULL;
re->re_str = strdup (ci->values[0].value.string);
re->next = NULL;
re->re_str = strdup (ci->values[0].value.string);
@@
-163,7
+162,7
@@
static int mr_config_add_regex (mr_regex_t **re_head, /* {{{ */
char errmsg[1024];
regerror (status, &re->re, errmsg, sizeof (errmsg));
errmsg[sizeof (errmsg) - 1] = 0;
char errmsg[1024];
regerror (status, &re->re, errmsg, sizeof (errmsg));
errmsg[sizeof (errmsg) - 1] = 0;
- log_err ("Compiling regex `%s' for `%s' failed: %s.",
+ log_err ("Compiling regex `%s' for `%s' failed: %s.",
re->re_str, ci->key, errmsg);
free (re->re_str);
free (re);
re->re_str, ci->key, errmsg);
free (re->re_str);
free (re);
@@
-194,14
+193,13
@@
static int mr_create (const oconfig_item_t *ci, void **user_data) /* {{{ */
int status;
int i;
int status;
int i;
- m =
malloc (
sizeof (*m));
+ m =
calloc (1,
sizeof (*m));
if (m == NULL)
{
if (m == NULL)
{
- log_err ("mr_create:
m
alloc failed.");
+ log_err ("mr_create:
c
alloc failed.");
return (-ENOMEM);
}
return (-ENOMEM);
}
- memset (m, 0, sizeof (*m));
-
+
m->invert = 0;
status = 0;
m->invert = 0;
status = 0;