ft_calloc: do not memset if malloc returns NULL

This commit is contained in:
Khaïs COLIN 2024-10-19 18:13:22 +02:00
parent afcddc5e14
commit 29f2cc104a

View file

@ -6,7 +6,7 @@
/* By: kcolin <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/17 10:20:05 by kcolin #+# #+# */
/* Updated: 2024/10/17 13:50:18 by kcolin ### ########.fr */
/* Updated: 2024/10/19 18:12:22 by kcolin ### ########.fr */
/* */
/* ************************************************************************** */
@ -24,6 +24,7 @@ void *ft_calloc(size_t nmemb, size_t size)
else
{
out = malloc(bytes);
if (out != NULL)
ft_memset(out, 0, bytes);
return (out);
}