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

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

Closed
wants to merge 1 commit into from
Closed

Conversation

hwde
Copy link
Contributor

@hwde hwde commented Jun 15, 2022

No description provided.

@Girgias Girgias requested a review from bukka June 15, 2022 12:34
Copy link
Member

@bukka bukka left a comment

Choose a reason for hiding this comment

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

Please can you create 2 PR's for this. One for conf and another one for zlog.

Comment on lines 1633 to 1636
if (ini_include) {
free(ini_include);
ini_include = NULL;
}
Copy link
Member

Choose a reason for hiding this comment

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

This looks like a correct and complete fix. Nice catch.

@@ -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.

@hwde
Copy link
Contributor Author

hwde commented Jun 15, 2022

2nd PR is #8794

@bukka
Copy link
Member

bukka commented Jun 27, 2022

Can you squash it to a single commit pls?

Revert "zlog: fix free“. will be in another PR

This reverts commit 9fccc56.
@devnexen
Copy link
Member

Fix already applied 325ca31

@devnexen devnexen closed this Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants