mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
fix: wrong check for malloc failure leads to failing tests
This commit is contained in:
parent
4fa56b45b6
commit
42bccd0a06
1 changed files with 5 additions and 3 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/03/04 12:07:53 by khais #+# #+# */
|
/* Created: 2025/03/04 12:07:53 by khais #+# #+# */
|
||||||
/* Updated: 2025/03/09 14:29:36 by khais ### ########.fr */
|
/* Updated: 2025/03/10 15:05:51 by khais ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -32,9 +32,11 @@ t_wordlist *wordlist_copy(const t_wordlist *wordlist)
|
||||||
while (wordlist != NULL)
|
while (wordlist != NULL)
|
||||||
{
|
{
|
||||||
if (wordlist->next != NULL)
|
if (wordlist->next != NULL)
|
||||||
|
{
|
||||||
current->next = ft_calloc(1, sizeof(t_wordlist));
|
current->next = ft_calloc(1, sizeof(t_wordlist));
|
||||||
if (current->next == NULL)
|
if (current->next == NULL)
|
||||||
return (wordlist_destroy(outlist), NULL);
|
return (wordlist_destroy(outlist), NULL);
|
||||||
|
}
|
||||||
wordlist = wordlist->next;
|
wordlist = wordlist->next;
|
||||||
current = current->next;
|
current = current->next;
|
||||||
if (wordlist == NULL)
|
if (wordlist == NULL)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue