Skip to content

Commit aaef92c

Browse files
committed
config_format: cf_yaml: Address review comments
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
1 parent bc08185 commit aaef92c

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/config_format/flb_cf_yaml.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1950,6 +1950,19 @@ static int consume_event(struct flb_cf *conf, struct local_ctx *ctx,
19501950
return YAML_FAILURE;
19511951
}
19521952
}
1953+
else if (state->section == SECTION_METADATA) {
1954+
variant = state_variant_parse_scalar(event);
1955+
if (variant == NULL) {
1956+
flb_error("unable to allocate memory for variant");
1957+
return YAML_FAILURE;
1958+
}
1959+
1960+
if (cfl_kvlist_insert(state->cf_section->properties, state->key, variant) < 0) {
1961+
cfl_variant_destroy(variant);
1962+
flb_error("unable to insert variant");
1963+
return YAML_FAILURE;
1964+
}
1965+
}
19531966
else {
19541967

19551968
/* register key/value pair as a property */
@@ -2418,6 +2431,7 @@ static int consume_event(struct flb_cf *conf, struct local_ctx *ctx,
24182431
}
24192432

24202433
if (cfl_kvlist_insert(state->cf_section->properties, state->key, variant) < 0) {
2434+
cfl_variant_destroy(variant);
24212435
flb_error("unable to insert variant");
24222436
return YAML_FAILURE;
24232437
}

0 commit comments

Comments
 (0)