Releases: libft/leak_test
Releases · libft/leak_test
v0.0.3
0.0.3
Breaking Changes
t_leak_test_options
has one more field. It's recommended to usebzero
to zero before use.- Now it's error to use test function that NOT call
malloc()
. Maybe useful to prevent passing incorrect function.
New Features
- Added various error values may useful to debugging.
- It's considered an error if no
malloc()
call in test function, andallow_empty
option isfalse
.
Bug Fixed
- Not calling
leak_test_end()
before test function end will not cause bug anymore.
Full Changelog: v0.0.2...v0.0.3
v0.0.2
0.0.2
Breaking Changes
- Header moved to
include/ft/
directory leak_test()
requires one more parameter
New Features
- Test count limit - prevent too long duration
- Handle unknown error from test function (return value)
Bug Fixed
- Context was NOT passed correctly
- Return value from test function didn't do anything
Full Changelog: v0.0.1...v0.0.2
v0.0.1
0.0.1
Usage
#include <stdlib.h>
#include <stdio.h>
#include <leak_test.h>
bool test(void *context)
{
leak_test_start();
// do what you want
// printf uses malloc inside.
// to NOT check leak for printf, skip leak test
leak_test_end();
printf("Hello world!\n");
leak_test_start();
// do what you want
return (false);
}
int main(void)
{
const int error = leak_test(&test, NULL);
if (error == FT_LEAK_TEST_RESULT_ERROR)
puts("Error occurred");
else if (error == FT_LEAK_TEST_RESULT_LEAK)
puts("LEAK FOUND!!!");
return (0);
}