From 217bcb0d4e3ba60604921cb40d5a11a64f93cfc7 Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 15 Jul 2019 10:20:37 +0200 Subject: c08 strdup malloc + 1 for \0, c09 begin --- c07/ex00/ft_strdup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'c07') diff --git a/c07/ex00/ft_strdup.c b/c07/ex00/ft_strdup.c index e53a3af..754f317 100644 --- a/c07/ex00/ft_strdup.c +++ b/c07/ex00/ft_strdup.c @@ -6,7 +6,7 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/07/07 15:39:50 by cacharle #+# #+# */ -/* Updated: 2019/07/09 07:36:10 by cacharle ### ########.fr */ +/* Updated: 2019/07/15 10:15:03 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -28,7 +28,7 @@ char *ft_strdup(char *src) int i; char *dup_ptr; - dup_ptr = (char*)malloc(sizeof(char) * ft_strlen(src)); + dup_ptr = (char*)malloc(sizeof(char) * ft_strlen(src) + 1); if (dup_ptr == NULL) { errno = ENOMEM; -- cgit