1
0

strdup fix - no space in malloc for \0

This commit is contained in:
Adam Joly
2023-11-04 11:11:33 +01:00
parent e4dc72f070
commit f10ad6adac

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/03 22:57:39 by adjoly #+# #+# */
/* Updated: 2023/11/03 23:08:23 by adjoly ### ########.fr */
/* Updated: 2023/11/04 11:10:30 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -20,7 +20,7 @@ char *ft_strdup(const char *s)
i = 0;
len = ft_strlen(s);
result = malloc(sizeof(char) * len);
result = malloc(sizeof(char) * (len + 1));
if (result == NULL)
return (NULL);
while (s[i])