X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fliboconfig%2Fparser.y;h=1eb7aecee0cade45c59f34a001d110caaa26093e;hb=edd9af8a874ebc9f2a7f02846807229a648917db;hp=803eec26205317b30c21425c9c2821a4f75321fe;hpb=a82395b57384541152423862bcf44c0db7789641;p=collectd.git diff --git a/src/liboconfig/parser.y b/src/liboconfig/parser.y index 803eec26..1eb7aece 100644 --- a/src/liboconfig/parser.y +++ b/src/liboconfig/parser.y @@ -208,15 +208,13 @@ statement_list: entire_file: statement_list { - ci_root = malloc (sizeof (oconfig_item_t)); - memset (ci_root, '\0', sizeof (oconfig_item_t)); + ci_root = calloc (1, sizeof (*ci_root)); ci_root->children = $1.statement; ci_root->children_num = $1.statement_num; } | /* epsilon */ { - ci_root = malloc (sizeof (oconfig_item_t)); - memset (ci_root, '\0', sizeof (oconfig_item_t)); + ci_root = calloc (1, sizeof (*ci_root)); ci_root->children = NULL; ci_root->children_num = 0; }