mirror of
https://github.com/DavidGailleton/42-Push_Swap.git
synced 2026-01-27 00:41:57 +00:00
final finish on the parsing protecting the malloc
This commit is contained in:
@@ -64,6 +64,11 @@ static t_stack *special_parsing(char **argv, int mod)
|
||||
return (NULL);
|
||||
len = len_split(split_tab);
|
||||
a = parsing(len, split_tab, mod);
|
||||
if (!a)
|
||||
{
|
||||
free_tab(split_tab);
|
||||
return (NULL);
|
||||
}
|
||||
free_tab(split_tab);
|
||||
return (a);
|
||||
}
|
||||
@@ -101,6 +106,11 @@ t_stacks *init_piles(int argc, char **argv, int mod)
|
||||
a = parsing(argc, argv, mod);
|
||||
else
|
||||
a = special_parsing(argv, mod);
|
||||
if (!a)
|
||||
{
|
||||
free(stacks);
|
||||
return (NULL);
|
||||
}
|
||||
stacks->a = a;
|
||||
return (stacks);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user