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 leaks #515

Open
wants to merge 4 commits into
base: bleeding
Choose a base branch
from
Open

Fix memory leaks #515

wants to merge 4 commits into from

Conversation

Arth-ur
Copy link

@Arth-ur Arth-ur commented Nov 26, 2023

Hello, this PR fixes some memory leaks so Criterion is now usable with Valgrind and AddressSanitizer.

The first commit fixes a memory leak in the handling of the -O/--output arguments. I've followed the Klib documentation https://attractivechaos.github.io/klib/#Khash%3A%20generic%20hash%20table to allocate and free the key for the hash table.

The second commit fixes a bug in the string conversion functions for C++. The strings are allocated using std::malloc, but were unallocated using free, which is aliased to cr_free, which couldn't handle unallocation properly.

The third commit fixes a memory leak in new asserts API. The allocated memory was not freed when the assert succeeds. I believe it also fixes issue #501.

Last commit adds missing cr_stream_close in the test failmessages.c that also lead to a memory leak.

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.

1 participant