testutil: add leak check function

This commit is contained in:
Khaïs COLIN 2025-03-06 15:06:31 +01:00
parent e2b6f6f943
commit 14dbabd6ea
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo
2 changed files with 11 additions and 1 deletions

View file

@ -22,3 +22,12 @@ void assert_strequal(char *str1, char *str2)
ft_dprintf(STDERR_FILENO, "to eq \t[%s]\n", str2); ft_dprintf(STDERR_FILENO, "to eq \t[%s]\n", str2);
assert(ret == 0); assert(ret == 0);
} }
extern void __lsan_do_leak_check(void)
__attribute__((weak));
void do_leak_check(void)
{
if (__lsan_do_leak_check != NULL)
__lsan_do_leak_check();
}

View file

@ -6,7 +6,7 @@
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */ /* By: khais <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/13 15:57:21 by khais #+# #+# */ /* Created: 2025/02/13 15:57:21 by khais #+# #+# */
/* Updated: 2025/02/13 15:57:44 by khais ### ########.fr */ /* Updated: 2025/03/06 15:30:55 by khais ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -14,5 +14,6 @@
# define TESTUTIL_H # define TESTUTIL_H
void assert_strequal(char *str1, char *str2); void assert_strequal(char *str1, char *str2);
void do_leak_check(void);
#endif #endif