Skip to content

Commit f07286a

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. Signed-off-by: Andrew Hayworth <[email protected]>
1 parent 979d10c commit f07286a

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
@@ -1437,14 +1437,16 @@ static int flb_main_run(int argc, char **argv)
14371437

14381438
if (config->dry_run == FLB_TRUE) {
14391439
ret = flb_reload_property_check_all(config);
1440-
if (ret != 0) {
1441-
exit(EXIT_FAILURE);
1442-
}
14431440

1444-
fprintf(stderr, "configuration test is successful\n");
1441+
/* At this point config test is done, so clean up after ourselves */
14451442
flb_init_env();
14461443
flb_cf_destroy(cf_opts);
14471444
flb_destroy(ctx);
1445+
1446+
if (ret != 0) {
1447+
exit(EXIT_FAILURE);
1448+
}
1449+
fprintf(stderr, "configuration test is successful\n");
14481450
exit(EXIT_SUCCESS);
14491451
}
14501452

0 commit comments

Comments
 (0)