strdup protection for @alao
This commit is contained in:
parent
39e91f5407
commit
084468644e
1 changed files with 3 additions and 2 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/07 14:25:41 by jhalford #+# #+# */
|
||||
/* Updated: 2016/12/07 15:29:38 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/01/10 10:56:33 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -18,7 +18,8 @@ char *ft_strdup(const char *s1)
|
|||
int i;
|
||||
|
||||
i = 0;
|
||||
dup = (char*)malloc(sizeof(*dup) * (ft_strlen(s1) + 1));
|
||||
if (!s1 || !(dup = (char*)malloc(sizeof(*dup) * (ft_strlen(s1) + 1))))
|
||||
return (NULL);
|
||||
ft_strcpy(dup, s1);
|
||||
return (dup);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue