Skip to content

Commit

Permalink
core: fix crash when running dry test mode (#8872)
Browse files Browse the repository at this point in the history
The tls variable for out_flush_params is not initialized as the
flb_start function is not called during the dry run. Call flb_init
directly and then shutdown the engine.

configuration test is successful
=================================================================
==63633==ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x0001f71b3ac0 in thread T0
    #0 0x103c9f260 in wrap_free+0x98 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x53260)
    #1 0x100179d9c in flb_free flb_mem.h:127
    #2 0x10017f4a0 in flb_output_exit flb_output.c:481
    #3 0x1001cb038 in flb_engine_shutdown flb_engine.c:1119
    #4 0x10010d45c in flb_destroy flb_lib.c:240
    #5 0x100008c40 in flb_main fluent-bit.c:1348
    #6 0x10000c644 in main fluent-bit.c:1456
    #7 0x18f11e0dc  (<unknown module>)

frame #6: 0x000000010017f4a4 fluent-bit`flb_output_exit(config=0x0000000102b00200) at flb_output.c:481:9
   478
   479 	    params = FLB_TLS_GET(out_flush_params);
   480 	    if (params) {
-> 481 	        flb_free(params);
   482 	    }
   483 	}

Signed-off-by: Holger Hans Peter Freyther <[email protected]>
  • Loading branch information
zecke authored May 26, 2024
1 parent 69b7f26 commit 9af65e2
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/fluent-bit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1344,6 +1344,7 @@ int flb_main(int argc, char **argv)

if (config->dry_run == FLB_TRUE) {
fprintf(stderr, "configuration test is successful\n");
flb_init_env();
flb_cf_destroy(cf_opts);
flb_destroy(ctx);
exit(EXIT_SUCCESS);
Expand Down

0 comments on commit 9af65e2

Please sign in to comment.