Skip to content

Fix memory leak in sh2peaks#2760

Merged
Lestropie merged 2 commits intodevfrom
leaksh2peaks
Jan 17, 2024
Merged

Fix memory leak in sh2peaks#2760
Lestropie merged 2 commits intodevfrom
leaksh2peaks

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
@github-actions
Copy link

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

@github-actions
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
@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