diff --git a/src/config_format/flb_cf_yaml.c b/src/config_format/flb_cf_yaml.c index 5fc42bdcb1d..2a571e59ea9 100644 --- a/src/config_format/flb_cf_yaml.c +++ b/src/config_format/flb_cf_yaml.c @@ -2039,7 +2039,9 @@ static int read_config(struct flb_cf *conf, struct local_ctx *ctx, } yaml_parser_delete(&parser); - state_pop(ctx); + + /* free all remaining states */ + while (state = state_pop(ctx)); fclose(fh); ctx->level--;