Skip to content

v0.0.1

Compare
Choose a tag to compare
@mjy9088 mjy9088 released this 14 May 15:13
· 28 commits to master since this release

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);
}