Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in_tail: avoid double free for multiline msgpack buffer #4187

Merged
merged 1 commit into from
Oct 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plugins/in_tail/tail_multiline.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ int flb_tail_mult_flush(msgpack_sbuffer *mp_sbuf, msgpack_packer *mp_pck,
file->mult_keys = 0;
file->mult_flush_timeout = 0;
msgpack_sbuffer_destroy(&file->mult_sbuf);
file->mult_sbuf.data = NULL;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So by setting it to NULL, then later on line 1024, when msgpack_sbuffer_destroy is called, it won't free it again since calling free on NULL does nothing, and that function is just a wrapper around free: https://github.com/msgpack/msgpack-c/blob/c_master/include/msgpack/sbuffer.h#L39

flb_time_zero(&file->mult_time);

return 0;
Expand Down