Skip to content

zlog: fix free, fpm_conf: set NULL after free #8785

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

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion sapi/fpm/fpm/zlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ zlog_bool zlog_stream_set_msg_suffix(
stream->msg_final_suffix_len = strlen(final_suffix);
len = stream->msg_final_suffix_len + 1;
if (stream->msg_final_suffix != NULL) {
free(stream->msg_suffix);
free(stream->msg_final_suffix);
Copy link
Member

Choose a reason for hiding this comment

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

This is even better catch. It's correct for the only used call of this function and I think it might be potentially reason for #8517 although not 100% sure about it. Anyway we should definitely fix this. It might need to be slightly changed logic (possibly later) as that function has got some logic that if you pass suffix as well as final_suffix, then final suffix is part of allocated suffix (see above) - that's the actual reason of this bug being introduced. However that path is not used so it will always be allocated below.

}
stream->msg_final_suffix = malloc(len);
if (stream->msg_final_suffix == NULL) {
Expand Down