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

decode: fix leak #30

Merged
merged 2 commits into from
Dec 22, 2022
Merged

decode: fix leak #30

merged 2 commits into from
Dec 22, 2022

Conversation

DavidKorczynski
Copy link
Contributor

Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=54137

Signed-off-by: David Korczynski <david@adalogics.com>
@DavidKorczynski
Copy link
Contributor Author

The CI error from the Markdown lint:

Error: .//examples/otlp-encoder/README.md:27: MD012 Multiple consecutive blank lines

is unrelated to this PR

@@ -117,6 +117,12 @@ static int unpack_instrumentation_scope_attributes(mpack_reader_t *reader, size_
result = unpack_cfl_kvlist(reader, &attributes->kv);

if (result != 0) {
if (attributes != NULL) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

You are right about the leak but please use ctr_attributes_destroy on attributes so if that object is modified in the future we're covered.

Additionally, would you mind adding a NULL check in line 112? It seems like I missed it and the result of ctr_attributes_create is not being checked which sucks (my bad!).

If you add the NULL check in line 112 you won't need to check if attributes is NULL here because unpack_cfl_kvlist only modifies the pointer held by the kv member.

Thanks a lot!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, done

Copy link
Collaborator

@leonardo-albertovich leonardo-albertovich left a comment

Choose a reason for hiding this comment

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

Thanks a lot!

Signed-off-by: David Korczynski <david@adalogics.com>
@edsiper edsiper merged commit 710f946 into fluent:master Dec 22, 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.

3 participants