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

out_stackdriver: fixed a memory leak (CID 508244) #9299

Merged
merged 2 commits into from
Aug 29, 2024

Conversation

leonardo-albertovich
Copy link
Collaborator

No description provided.

Signed-off-by: Leonardo Alminana <leonardo.alminana@chronosphere.io>
@leonardo-albertovich
Copy link
Collaborator Author

@igorpeshansky I performed a cursory inspection to validate (and expand) the findings and patched the leaks I could confirm, however I'm not familiar with the stackdriver plugin and would greatly appreciate if someone from the team could verify this PR.

Additionally, It seems that source_location_file and source_location_function are also leaked, could you verify this?

@braydonk
Copy link
Contributor

braydonk commented Aug 29, 2024

Thanks for fixing this. These cleanups were missed when I reviewed the PRs by external contributors, I should have caught them.

source_location_file and source_location_function don't look like they should be leaked, at least a look at the code indicates they should be cleaned up.

They are allocated here (not guarded by any condition):

source_location_file = flb_sds_create("");
source_location_line = 0;
source_location_function = flb_sds_create("");
source_location_extra_size = 0;

Then cleaned up here (also not guarded by any conditions):

flb_sds_destroy(source_location_file);
flb_sds_destroy(source_location_function);

@leonardo-albertovich
Copy link
Collaborator Author

I meant they would be leaked if this code path was taken.

@braydonk
Copy link
Contributor

I didn't notice that, yeah you're right that's a leak.

Signed-off-by: Leonardo Alminana <leonardo.alminana@chronosphere.io>
@edsiper edsiper merged commit 4c95e88 into master Aug 29, 2024
42 of 44 checks passed
@edsiper edsiper deleted the leonardo-master-coverity-issue-508244 branch August 29, 2024 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants