projects
/
collectd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5770214
)
tail_csv: malloc + memset -> calloc
author
Ruben Kerkhof
<ruben@rubenkerkhof.com>
Fri, 1 Apr 2016 16:20:59 +0000
(18:20 +0200)
committer
Ruben Kerkhof
<ruben@rubenkerkhof.com>
Fri, 1 Apr 2016 16:20:59 +0000
(18:20 +0200)
src/tail_csv.c
patch
|
blob
|
history
diff --git
a/src/tail_csv.c
b/src/tail_csv.c
index
15c083e
..
2d794fc
100644
(file)
--- a/
src/tail_csv.c
+++ b/
src/tail_csv.c
@@
-290,10
+290,9
@@
static int tcsv_config_add_metric(oconfig_item_t *ci){
int status;
int i;
- md =
malloc(
sizeof(*md));
+ md =
calloc(1,
sizeof(*md));
if (md == NULL)
return (-1);
- memset(md, 0, sizeof(*md));
md->name = NULL;
md->type = NULL;
md->instance = NULL;
@@
-426,10
+425,9
@@
static int tcsv_config_add_file(oconfig_item_t *ci)
char cb_name[DATA_MAX_NAME_LEN];
user_data_t cb_data;
- id =
malloc(
sizeof(*id));
+ id =
calloc(1,
sizeof(*id));
if (id == NULL)
return (-1);
- memset(id, 0, sizeof(*id));
id->instance = NULL;
id->path = NULL;
id->metric_list = NULL;