projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
04d03d3
)
daemon: malloc + memset -> calloc
author
Ruben Kerkhof
<ruben@rubenkerkhof.com>
Mon, 28 Mar 2016 17:56:13 +0000
(19:56 +0200)
committer
Ruben Kerkhof
<ruben@rubenkerkhof.com>
Fri, 1 Apr 2016 13:39:42 +0000
(15:39 +0200)
14 files changed:
src/daemon/common.c
patch
|
blob
|
history
src/daemon/configfile.c
patch
|
blob
|
history
src/daemon/filter_chain.c
patch
|
blob
|
history
src/daemon/meta_data.c
patch
|
blob
|
history
src/daemon/plugin.c
patch
|
blob
|
history
src/daemon/types_list.c
patch
|
blob
|
history
src/daemon/utils_avltree.c
patch
|
blob
|
history
src/daemon/utils_cache.c
patch
|
blob
|
history
src/daemon/utils_heap.c
patch
|
blob
|
history
src/daemon/utils_ignorelist.c
patch
|
blob
|
history
src/daemon/utils_llist.c
patch
|
blob
|
history
src/daemon/utils_match.c
patch
|
blob
|
history
src/daemon/utils_tail.c
patch
|
blob
|
history
src/daemon/utils_tail_match.c
patch
|
blob
|
history
diff --git
a/src/daemon/common.c
b/src/daemon/common.c
index
2f6da95
..
7b7353d
100644
(file)
--- a/
src/daemon/common.c
+++ b/
src/daemon/common.c
@@
-115,10
+115,9
@@
char *ssnprintf_alloc (char const *format, ...) /* {{{ */
return (strdup (static_buffer));
/* Allocate a buffer large enough to hold the string. */
return (strdup (static_buffer));
/* Allocate a buffer large enough to hold the string. */
- alloc_buffer =
malloc (
alloc_buffer_size);
+ alloc_buffer =
calloc (1,
alloc_buffer_size);
if (alloc_buffer == NULL)
return (NULL);
if (alloc_buffer == NULL)
return (NULL);
- memset (alloc_buffer, 0, alloc_buffer_size);
/* Print again into this new buffer. */
va_start (ap, format);
/* Print again into this new buffer. */
va_start (ap, format);
@@
-409,10
+408,9
@@
int escape_string (char *buffer, size_t buffer_size)
if (buffer_size < 3)
return (EINVAL);
if (buffer_size < 3)
return (EINVAL);
- temp =
malloc (
buffer_size);
+ temp =
calloc (1,
buffer_size);
if (temp == NULL)
return (ENOMEM);
if (temp == NULL)
return (ENOMEM);
- memset (temp, 0, buffer_size);
temp[0] = '"';
j = 1;
temp[0] = '"';
j = 1;
diff --git
a/src/daemon/configfile.c
b/src/daemon/configfile.c
index
5f49a9e
..
78d4eea
100644
(file)
--- a/
src/daemon/configfile.c
+++ b/
src/daemon/configfile.c
@@
-717,14
+717,13
@@
static oconfig_item_t *cf_read_dir (const char *dir,
return (NULL);
}
return (NULL);
}
- root =
malloc (
sizeof (*root));
+ root =
calloc (1,
sizeof (*root));
if (root == NULL)
{
if (root == NULL)
{
- ERROR ("configfile:
m
alloc failed.");
+ ERROR ("configfile:
c
alloc failed.");
closedir (dh);
return (NULL);
}
closedir (dh);
return (NULL);
}
- memset (root, 0, sizeof (oconfig_item_t));
while ((de = readdir (dh)) != NULL)
{
while ((de = readdir (dh)) != NULL)
{
@@
-835,13
+834,12
@@
static oconfig_item_t *cf_read_generic (const char *path,
return (NULL);
}
return (NULL);
}
- root =
malloc (
sizeof (*root));
+ root =
calloc (1,
sizeof (*root));
if (root == NULL)
{
if (root == NULL)
{
- ERROR ("configfile:
m
alloc failed.");
+ ERROR ("configfile:
c
alloc failed.");
return (NULL);
}
return (NULL);
}
- memset (root, '\0', sizeof (oconfig_item_t));
/* wordexp() might return a sorted list already. That's not
* documented though, so let's make sure we get what we want. */
/* wordexp() might return a sorted list already. That's not
* documented though, so let's make sure we get what we want. */
diff --git
a/src/daemon/filter_chain.c
b/src/daemon/filter_chain.c
index
b599d70
..
babf399
100644
(file)
--- a/
src/daemon/filter_chain.c
+++ b/
src/daemon/filter_chain.c
@@
-235,13
+235,12
@@
static int fc_config_add_match (fc_match_t **matches_head, /* {{{ */
return (-1);
}
return (-1);
}
- m =
malloc (
sizeof (*m));
+ m =
calloc (1,
sizeof (*m));
if (m == NULL)
{
if (m == NULL)
{
- ERROR ("fc_config_add_match:
m
alloc failed.");
+ ERROR ("fc_config_add_match:
c
alloc failed.");
return (-1);
}
return (-1);
}
- memset (m, 0, sizeof (*m));
sstrncpy (m->name, ptr->name, sizeof (m->name));
memcpy (&m->proc, &ptr->proc, sizeof (m->proc));
sstrncpy (m->name, ptr->name, sizeof (m->name));
memcpy (&m->proc, &ptr->proc, sizeof (m->proc));
@@
-307,13
+306,12
@@
static int fc_config_add_target (fc_target_t **targets_head, /* {{{ */
return (-1);
}
return (-1);
}
- t =
malloc (
sizeof (*t));
+ t =
calloc (1,
sizeof (*t));
if (t == NULL)
{
if (t == NULL)
{
- ERROR ("fc_config_add_target:
m
alloc failed.");
+ ERROR ("fc_config_add_target:
c
alloc failed.");
return (-1);
}
return (-1);
}
- memset (t, 0, sizeof (*t));
sstrncpy (t->name, ptr->name, sizeof (t->name));
memcpy (&t->proc, &ptr->proc, sizeof (t->proc));
sstrncpy (t->name, ptr->name, sizeof (t->name));
memcpy (&t->proc, &ptr->proc, sizeof (t->proc));
@@
-373,14
+371,12
@@
static int fc_config_add_rule (fc_chain_t *chain, /* {{{ */
return (-1);
}
return (-1);
}
- rule =
malloc (
sizeof (*rule));
+ rule =
calloc (1,
sizeof (*rule));
if (rule == NULL)
{
if (rule == NULL)
{
- ERROR ("fc_config_add_rule:
m
alloc failed.");
+ ERROR ("fc_config_add_rule:
c
alloc failed.");
return (-1);
}
return (-1);
}
- memset (rule, 0, sizeof (*rule));
- rule->next = NULL;
if (ci->values_num == 1)
{
if (ci->values_num == 1)
{
@@
-469,17
+465,13
@@
static int fc_config_add_chain (const oconfig_item_t *ci) /* {{{ */
if (chain == NULL)
{
if (chain == NULL)
{
- chain =
malloc (
sizeof (*chain));
+ chain =
calloc (1,
sizeof (*chain));
if (chain == NULL)
{
if (chain == NULL)
{
- ERROR ("fc_config_add_chain:
m
alloc failed.");
+ ERROR ("fc_config_add_chain:
c
alloc failed.");
return (-1);
}
return (-1);
}
- memset (chain, 0, sizeof (*chain));
sstrncpy (chain->name, ci->values[0].value.string, sizeof (chain->name));
sstrncpy (chain->name, ci->values[0].value.string, sizeof (chain->name));
- chain->rules = NULL;
- chain->targets = NULL;
- chain->next = NULL;
}
for (i = 0; i < ci->children_num; i++)
}
for (i = 0; i < ci->children_num; i++)
@@
-824,14
+816,12
@@
int fc_register_match (const char *name, match_proc_t proc) /* {{{ */
DEBUG ("fc_register_match (%s);", name);
DEBUG ("fc_register_match (%s);", name);
- m =
malloc (
sizeof (*m));
+ m =
calloc (1,
sizeof (*m));
if (m == NULL)
return (-ENOMEM);
if (m == NULL)
return (-ENOMEM);
- memset (m, 0, sizeof (*m));
sstrncpy (m->name, name, sizeof (m->name));
memcpy (&m->proc, &proc, sizeof (m->proc));
sstrncpy (m->name, name, sizeof (m->name));
memcpy (&m->proc, &proc, sizeof (m->proc));
- m->next = NULL;
if (match_list_head == NULL)
{
if (match_list_head == NULL)
{
@@
-858,14
+848,12
@@
int fc_register_target (const char *name, target_proc_t proc) /* {{{ */
DEBUG ("fc_register_target (%s);", name);
DEBUG ("fc_register_target (%s);", name);
- t =
malloc (
sizeof (*t));
+ t =
calloc (1,
sizeof (*t));
if (t == NULL)
return (-ENOMEM);
if (t == NULL)
return (-ENOMEM);
- memset (t, 0, sizeof (*t));
sstrncpy (t->name, name, sizeof (t->name));
memcpy (&t->proc, &proc, sizeof (t->proc));
sstrncpy (t->name, name, sizeof (t->name));
memcpy (&t->proc, &proc, sizeof (t->proc));
- t->next = NULL;
if (target_list_head == NULL)
{
if (target_list_head == NULL)
{
diff --git
a/src/daemon/meta_data.c
b/src/daemon/meta_data.c
index
1067864
..
cb8a195
100644
(file)
--- a/
src/daemon/meta_data.c
+++ b/
src/daemon/meta_data.c
@@
-84,13
+84,12
@@
static meta_entry_t *md_entry_alloc (const char *key) /* {{{ */
{
meta_entry_t *e;
{
meta_entry_t *e;
- e =
malloc (
sizeof (*e));
+ e =
calloc (1,
sizeof (*e));
if (e == NULL)
{
if (e == NULL)
{
- ERROR ("md_entry_alloc:
m
alloc failed.");
+ ERROR ("md_entry_alloc:
c
alloc failed.");
return (NULL);
}
return (NULL);
}
- memset (e, 0, sizeof (*e));
e->key = md_strdup (key);
if (e->key == NULL)
e->key = md_strdup (key);
if (e->key == NULL)
@@
-220,15
+219,13
@@
meta_data_t *meta_data_create (void) /* {{{ */
{
meta_data_t *md;
{
meta_data_t *md;
- md =
malloc (
sizeof (*md));
+ md =
calloc (1,
sizeof (*md));
if (md == NULL)
{
if (md == NULL)
{
- ERROR ("meta_data_create:
m
alloc failed.");
+ ERROR ("meta_data_create:
c
alloc failed.");
return (NULL);
}
return (NULL);
}
- memset (md, 0, sizeof (*md));
- md->head = NULL;
pthread_mutex_init (&md->lock, /* attr = */ NULL);
return (md);
pthread_mutex_init (&md->lock, /* attr = */ NULL);
return (md);
diff --git
a/src/daemon/plugin.c
b/src/daemon/plugin.c
index
6c8b6b0
..
e593939
100644
(file)
--- a/
src/daemon/plugin.c
+++ b/
src/daemon/plugin.c
@@
-368,13
+368,12
@@
static int create_register_callback (llist_t **list, /* {{{ */
{
callback_func_t *cf;
{
callback_func_t *cf;
- cf =
malloc (
sizeof (*cf));
+ cf =
calloc (1,
sizeof (*cf));
if (cf == NULL)
{
if (cf == NULL)
{
- ERROR ("plugin: create_register_callback:
m
alloc failed.");
+ ERROR ("plugin: create_register_callback:
c
alloc failed.");
return (-1);
}
return (-1);
}
- memset (cf, 0, sizeof (*cf));
cf->cf_callback = callback;
if (ud == NULL)
cf->cf_callback = callback;
if (ud == NULL)
@@
-1244,14
+1243,13
@@
int plugin_register_read (const char *name,
read_func_t *rf;
int status;
read_func_t *rf;
int status;
- rf =
malloc (
sizeof (*rf));
+ rf =
calloc (1,
sizeof (*rf));
if (rf == NULL)
{
if (rf == NULL)
{
- ERROR ("plugin_register_read:
m
alloc failed.");
+ ERROR ("plugin_register_read:
c
alloc failed.");
return (ENOMEM);
}
return (ENOMEM);
}
- memset (rf, 0, sizeof (read_func_t));
rf->rf_callback = (void *) callback;
rf->rf_udata.data = NULL;
rf->rf_udata.free_func = NULL;
rf->rf_callback = (void *) callback;
rf->rf_udata.data = NULL;
rf->rf_udata.free_func = NULL;
@@
-1278,14
+1276,13
@@
int plugin_register_complex_read (const char *group, const char *name,
read_func_t *rf;
int status;
read_func_t *rf;
int status;
- rf =
malloc (
sizeof (*rf));
+ rf =
calloc (1,
sizeof (*rf));
if (rf == NULL)
{
if (rf == NULL)
{
- ERROR ("plugin_register_complex_read:
m
alloc failed.");
+ ERROR ("plugin_register_complex_read:
c
alloc failed.");
return (ENOMEM);
}
return (ENOMEM);
}
- memset (rf, 0, sizeof (read_func_t));
rf->rf_callback = (void *) callback;
if (group != NULL)
sstrncpy (rf->rf_group, group, sizeof (rf->rf_group));
rf->rf_callback = (void *) callback;
if (group != NULL)
sstrncpy (rf->rf_group, group, sizeof (rf->rf_group));
@@
-2578,13
+2575,12
@@
static int plugin_notification_meta_add (notification_t *n,
return (-1);
}
return (-1);
}
- meta =
malloc (
sizeof (*meta));
+ meta =
calloc (1,
sizeof (*meta));
if (meta == NULL)
{
if (meta == NULL)
{
- ERROR ("plugin_notification_meta_add:
m
alloc failed.");
+ ERROR ("plugin_notification_meta_add:
c
alloc failed.");
return (-1);
}
return (-1);
}
- memset (meta, 0, sizeof (notification_meta_t));
sstrncpy (meta->name, name, sizeof (meta->name));
meta->type = type;
sstrncpy (meta->name, name, sizeof (meta->name));
meta->type = type;
diff --git
a/src/daemon/types_list.c
b/src/daemon/types_list.c
index
3ac38f2
..
de6fce3
100644
(file)
--- a/
src/daemon/types_list.c
+++ b/
src/daemon/types_list.c
@@
-112,12
+112,10
@@
static void parse_line (char *buf)
if (fields[0][0] == '#')
return;
if (fields[0][0] == '#')
return;
- ds =
malloc (
sizeof (*ds));
+ ds =
calloc (1,
sizeof (*ds));
if (ds == NULL)
return;
if (ds == NULL)
return;
- memset (ds, '\0', sizeof (data_set_t));
-
sstrncpy (ds->type, fields[0], sizeof (ds->type));
ds->ds_num = fields_num - 1;
sstrncpy (ds->type, fields[0], sizeof (ds->type));
ds->ds_num = fields_num - 1;
diff --git
a/src/daemon/utils_avltree.c
b/src/daemon/utils_avltree.c
index
bf6880c
..
1680c41
100644
(file)
--- a/
src/daemon/utils_avltree.c
+++ b/
src/daemon/utils_avltree.c
@@
-665,10
+665,9
@@
c_avl_iterator_t *c_avl_get_iterator (c_avl_tree_t *t)
if (t == NULL)
return (NULL);
if (t == NULL)
return (NULL);
- iter =
malloc (
sizeof (*iter));
+ iter =
calloc (1,
sizeof (*iter));
if (iter == NULL)
return (NULL);
if (iter == NULL)
return (NULL);
- memset (iter, '\0', sizeof (c_avl_iterator_t));
iter->tree = t;
return (iter);
iter->tree = t;
return (iter);
diff --git
a/src/daemon/utils_cache.c
b/src/daemon/utils_cache.c
index
7f0d228
..
e1cfac9
100644
(file)
--- a/
src/daemon/utils_cache.c
+++ b/
src/daemon/utils_cache.c
@@
-83,13
+83,12
@@
static cache_entry_t *cache_alloc (size_t values_num)
{
cache_entry_t *ce;
{
cache_entry_t *ce;
- ce =
malloc (
sizeof (*ce));
+ ce =
calloc (1,
sizeof (*ce));
if (ce == NULL)
{
if (ce == NULL)
{
- ERROR ("utils_cache: cache_alloc:
m
alloc failed.");
+ ERROR ("utils_cache: cache_alloc:
c
alloc failed.");
return (NULL);
}
return (NULL);
}
- memset (ce, '\0', sizeof (cache_entry_t));
ce->values_num = values_num;
ce->values_gauge = calloc (values_num, sizeof (*ce->values_gauge));
ce->values_num = values_num;
ce->values_gauge = calloc (values_num, sizeof (*ce->values_gauge));
diff --git
a/src/daemon/utils_heap.c
b/src/daemon/utils_heap.c
index
1b5dca7
..
ae502c9
100644
(file)
--- a/
src/daemon/utils_heap.c
+++ b/
src/daemon/utils_heap.c
@@
-112,14
+112,13
@@
c_heap_t *c_heap_create (int (*compare) (const void *, const void *))
if (compare == NULL)
return (NULL);
if (compare == 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));
pthread_mutex_init (&h->lock, /* attr = */ NULL);
h->compare = compare;
pthread_mutex_init (&h->lock, /* attr = */ NULL);
h->compare = compare;
-
+
h->list = NULL;
h->list_len = 0;
h->list_size = 0;
h->list = NULL;
h->list_len = 0;
h->list_size = 0;
diff --git
a/src/daemon/utils_ignorelist.c
b/src/daemon/utils_ignorelist.c
index
011b3d3
..
d867c84
100644
(file)
--- a/
src/daemon/utils_ignorelist.c
+++ b/
src/daemon/utils_ignorelist.c
@@
-94,13
+94,12
@@
static int ignorelist_append_regex(ignorelist_t *il, const char *re_str)
ignorelist_item_t *entry;
int status;
ignorelist_item_t *entry;
int status;
- re =
malloc (
sizeof (*re));
+ re =
calloc (1,
sizeof (*re));
if (re == NULL)
{
if (re == NULL)
{
- ERROR ("ignorelist_append_regex:
m
alloc failed.");
+ ERROR ("ignorelist_append_regex:
c
alloc failed.");
return (ENOMEM);
}
return (ENOMEM);
}
- memset (re, 0, sizeof (*re));
status = regcomp (re, re_str, REG_EXTENDED);
if (status != 0)
status = regcomp (re, re_str, REG_EXTENDED);
if (status != 0)
@@
-113,15
+112,14
@@
static int ignorelist_append_regex(ignorelist_t *il, const char *re_str)
return (status);
}
return (status);
}
- entry =
malloc (
sizeof (*entry));
+ entry =
calloc (1,
sizeof (*entry));
if (entry == NULL)
{
if (entry == NULL)
{
- ERROR ("ignorelist_append_regex:
m
alloc failed.");
+ ERROR ("ignorelist_append_regex:
c
alloc failed.");
regfree (re);
sfree (re);
return (ENOMEM);
}
regfree (re);
sfree (re);
return (ENOMEM);
}
- memset (entry, 0, sizeof (*entry));
entry->rmatch = re;
ignorelist_append (il, entry);
entry->rmatch = re;
ignorelist_append (il, entry);
@@
-134,12
+132,11
@@
static int ignorelist_append_string(ignorelist_t *il, const char *entry)
ignorelist_item_t *new;
/* create new entry */
ignorelist_item_t *new;
/* create new entry */
- if ((new =
malloc(
sizeof (*new))) == NULL )
+ if ((new =
calloc(1,
sizeof (*new))) == NULL )
{
ERROR ("cannot allocate new entry");
return (1);
}
{
ERROR ("cannot allocate new entry");
return (1);
}
- memset (new, '\0', sizeof(ignorelist_item_t));
new->smatch = sstrdup(entry);
/* append new entry */
new->smatch = sstrdup(entry);
/* append new entry */
@@
-194,10
+191,9
@@
ignorelist_t *ignorelist_create (int invert)
{
ignorelist_t *il;
{
ignorelist_t *il;
- il =
malloc (
sizeof (*il));
+ il =
calloc (1,
sizeof (*il));
if (il == NULL)
return NULL;
if (il == NULL)
return NULL;
- memset (il, 0, sizeof (*il));
/*
* ->ignore == 0 => collect
/*
* ->ignore == 0 => collect
diff --git
a/src/daemon/utils_llist.c
b/src/daemon/utils_llist.c
index
40dd0ea
..
1a6188f
100644
(file)
--- a/
src/daemon/utils_llist.c
+++ b/
src/daemon/utils_llist.c
@@
-48,12
+48,10
@@
llist_t *llist_create (void)
{
llist_t *ret;
{
llist_t *ret;
- ret =
malloc (
sizeof (*ret));
+ ret =
calloc (1,
sizeof (*ret));
if (ret == NULL)
return (NULL);
if (ret == NULL)
return (NULL);
- memset (ret, '\0', sizeof (llist_t));
-
return (ret);
}
return (ret);
}
diff --git
a/src/daemon/utils_match.c
b/src/daemon/utils_match.c
index
c1d99e1
..
cf87b6b
100644
(file)
--- 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);
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);
if (obj == NULL)
return (NULL);
- memset (obj, '\0', sizeof (cu_match_t));
status = regcomp (&obj->regex, regex, REG_EXTENDED | REG_NEWLINE);
if (status != 0)
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;
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);
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,
user_data->ds_type = match_ds_type;
obj = match_create_callback (regex, excluderegex,
diff --git
a/src/daemon/utils_tail.c
b/src/daemon/utils_tail.c
index
c4b73c3
..
0b0a8fb
100644
(file)
--- a/
src/daemon/utils_tail.c
+++ b/
src/daemon/utils_tail.c
@@
-119,10
+119,9
@@
cu_tail_t *cu_tail_create (const char *file)
{
cu_tail_t *obj;
{
cu_tail_t *obj;
- obj =
malloc (
sizeof (*obj));
+ obj =
calloc (1,
sizeof (*obj));
if (obj == NULL)
return (NULL);
if (obj == NULL)
return (NULL);
- memset (obj, '\0', sizeof (cu_tail_t));
obj->file = strdup (file);
if (obj->file == NULL)
obj->file = strdup (file);
if (obj->file == NULL)
diff --git
a/src/daemon/utils_tail_match.c
b/src/daemon/utils_tail_match.c
index
c8fd05e
..
1e5da95
100644
(file)
--- 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;
{
cu_tail_match_t *obj;
- obj =
malloc (
sizeof (*obj));
+ obj =
calloc (1,
sizeof (*obj));
if (obj == NULL)
return (NULL);
if (obj == NULL)
return (NULL);
- memset (obj, '\0', sizeof (cu_tail_match_t));
obj->tail = cu_tail_create (filename);
if (obj->tail == NULL)
obj->tail = cu_tail_create (filename);
if (obj->tail == NULL)
@@
-212,13
+211,12
@@
int tail_match_add_match_simple (cu_tail_match_t *obj,
if (match == NULL)
return (-1);
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);
}
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)
sstrncpy (user_data->plugin, plugin, sizeof (user_data->plugin));
if (plugin_instance != NULL)