Skip to content

Commit d8decf0

Browse files
committed
ml_parser: Address coderabbitai comment
Signed-off-by: Hiroshi Hatake <[email protected]>
1 parent ecf141d commit d8decf0

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/multiline/flb_ml_parser.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,14 @@ struct flb_ml_parser *flb_ml_parser_create_params(struct flb_config *ctx,
6060
return NULL;
6161
}
6262

63+
/* prepare rules list */
64+
mk_list_init(&ml_parser->_head);
65+
mk_list_init(&ml_parser->regex_rules);
66+
6367
/* name/type */
6468
ml_parser->name = flb_sds_create(p->name);
6569
if (!ml_parser->name) {
66-
flb_free(ml_parser);
70+
flb_ml_parser_destroy(ml_parser);
6771
return NULL;
6872
}
6973
ml_parser->type = p->type;
@@ -72,8 +76,7 @@ struct flb_ml_parser *flb_ml_parser_create_params(struct flb_config *ctx,
7276
if (p->match_str) {
7377
ml_parser->match_str = flb_sds_create(p->match_str);
7478
if (!ml_parser->match_str) {
75-
flb_sds_destroy(ml_parser->name);
76-
flb_free(ml_parser);
79+
flb_ml_parser_destroy(ml_parser);
7780
return NULL;
7881
}
7982
}
@@ -92,8 +95,6 @@ struct flb_ml_parser *flb_ml_parser_create_params(struct flb_config *ctx,
9295
ml_parser->negate = p->negate;
9396
ml_parser->flush_ms = (p->flush_ms > 0) ? p->flush_ms : FLB_ML_FLUSH_TIMEOUT;
9497

95-
/* prepare rules list */
96-
mk_list_init(&ml_parser->regex_rules);
9798

9899
/* optional keys */
99100
if (p->key_content) {

0 commit comments

Comments
 (0)