Skip to content

Commit

Permalink
input: make flb_input_new() zero-initialize input instances
Browse files Browse the repository at this point in the history
I noticed that Fluent Bit sometimes fails to start up with SIGSEGV,
seemingly at random.

The reason turned out that some fields in flb_input_instance were
not initialized to NULL properly, so conditionals such as

    if (in->host.listen) {
        listen = in->host.listen;
    }

... were not really reliable, and could pass a random memory
location to variables. Fix it.

Signed-off-by: Fujimoto Seiji <[email protected]>
  • Loading branch information
Fujimoto Seiji authored and edsiper committed Jan 23, 2020
1 parent 80d1c82 commit 746656d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/flb_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ struct flb_input_instance *flb_input_new(struct flb_config *config,
}

/* Create plugin instance */
instance = flb_malloc(sizeof(struct flb_input_instance));
instance = flb_calloc(1, sizeof(struct flb_input_instance));
if (!instance) {
flb_errno();
return NULL;
Expand Down

0 comments on commit 746656d

Please sign in to comment.