Skip to content

Commit 4d255f8

Browse files
committed
bin: ensure we clean up after error and successful dry-run
We need to perform the same partial initialization and releasing of resources whether or not the dry-run was successful, so this commit ensures that we call those functions before exiting either way.
1 parent 57442a0 commit 4d255f8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/fluent-bit.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,14 +1431,16 @@ static int flb_main_run(int argc, char **argv)
14311431

14321432
if (config->dry_run == FLB_TRUE) {
14331433
ret = flb_reload_property_check_all(config);
1434-
if (ret != 0) {
1435-
exit(EXIT_FAILURE);
1436-
}
14371434

1438-
fprintf(stderr, "configuration test is successful\n");
1435+
/* At this point config test is done, so clean up after ourselves */
14391436
flb_init_env();
14401437
flb_cf_destroy(cf_opts);
14411438
flb_destroy(ctx);
1439+
1440+
if (ret != 0) {
1441+
exit(EXIT_FAILURE);
1442+
}
1443+
fprintf(stderr, "configuration test is successful\n");
14421444
exit(EXIT_SUCCESS);
14431445
}
14441446

0 commit comments

Comments
 (0)