ft_lstnew: corrected faulty content asignation

This commit is contained in:
Tanguy MAZE 2018-04-08 17:16:44 +02:00
parent 9845b74cb7
commit 4a751e7f3c

View File

@ -6,7 +6,7 @@
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */ /* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2018/04/08 00:35:42 by tmaze #+# #+# */ /* Created: 2018/04/08 00:35:42 by tmaze #+# #+# */
/* Updated: 2018/04/08 00:50:46 by tmaze ### ########.fr */ /* Updated: 2018/04/08 17:15:34 by tmaze ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -16,7 +16,7 @@ t_list *ft_lstnew(void const *content, size_t content_size)
{ {
t_list *ret; t_list *ret;
if ((ret = (t_list*)malloc(sizeof(t_list))) == NULL) if ((ret = (t_list*)malloc(sizeof(t_list))) != NULL)
{ {
if (!content) if (!content)
{ {
@ -30,6 +30,7 @@ t_list *ft_lstnew(void const *content, size_t content_size)
free(ret); free(ret);
return (0); return (0);
} }
ft_memmove(ret->content, content, content_size);
ret->content_size = content_size; ret->content_size = content_size;
} }
ret->next = NULL; ret->next = NULL;