-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_trymalloc.c
27 lines (24 loc) · 1.13 KB
/
ft_trymalloc.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_trymalloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rabougue <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/12 05:33:13 by rabougue #+# #+# */
/* Updated: 2017/02/12 05:43:17 by rabougue ### ########.fr */
/* */
/* ************************************************************************** */
#include "./includes/libft.h"
void *ft_trymalloc(size_t size)
{
char *str;
str = NULL;
if ((str = (void *)malloc(size)) == NULL)
{
ft_putendl_fd(RED"ft_trymalloc : Memory allocation failure"END, 2);
exit(-1);
}
ft_memset(str, 0, size);
return (str);
}