mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
fix potential memory leak in cmdlist_from_wordlist
This leak would happen if the alocation of the builder fails. In that case, we don't free our copy of the wordlist
This commit is contained in:
parent
bed8c9d507
commit
73a64b2ec3
1 changed files with 2 additions and 2 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/24 17:49:46 by khais #+# #+# */
|
||||
/* Updated: 2025/03/19 16:43:14 by khais ### ########.fr */
|
||||
/* Updated: 2025/03/20 12:23:39 by khais ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ t_cmdlist *cmdlist_from_wordlist(const t_wordlist *wordlist)
|
|||
if (words == NULL)
|
||||
return (NULL);
|
||||
if (setup_cmdlist_builder(&builder, &words) == NULL)
|
||||
return (NULL);
|
||||
return (wordlist_destroy(words), NULL);
|
||||
while (builder.error == false && builder.current_word != NULL)
|
||||
{
|
||||
if (match_op(builder.current_word->word) == OP_INVALID)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue