Skip to content

Conversation

Arth-ur
Copy link
Contributor

@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.

Fixes #501

Copy link
Collaborator

@MrAnno MrAnno left a comment

Choose a reason for hiding this comment

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

Thank you.

@MrAnno MrAnno merged commit 2615839 into Snaipe:bleeding Oct 4, 2025
8 of 10 checks passed
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.

Memory leak when using array type tags

2 participants