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

Fix memory leak in sh2peaks #2760

Merged
merged 2 commits into from
Jan 17, 2024
Merged

Fix memory leak in sh2peaks #2760

merged 2 commits into from
Jan 17, 2024

Conversation

daljit46
Copy link
Member

This was found using Address Sanitizer on the dev branch. The Processor class defined in sh2peaks.cpp allocated its precomputer member variable on the heap using a raw pointer. The allocated memory was never freed, leading to a memory leak. The fix allocates the memory using a shared_ptr (unique_ptr wasn't used as we need our functors to be copyable for multithreaded purposes).

The precomputer instance in Processor was allocated as a raw pointer and thus never freed.
@daljit46 daljit46 self-assigned this Nov 29, 2023
@daljit46 daljit46 added the bug label Nov 29, 2023
Copy link

clang-tidy review says "All clean, LGTM! 👍"

Copy link

clang-tidy review says "All clean, LGTM! 👍"

@Lestropie Lestropie enabled auto-merge January 17, 2024 09:57
@Lestropie Lestropie merged commit 808adc3 into dev Jan 17, 2024
6 checks passed
@Lestropie Lestropie deleted the leaksh2peaks branch January 17, 2024 10:24
@Lestropie Lestropie mentioned this pull request Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants