diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-08-01 21:25:09 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-08-01 21:25:09 +0200 |
commit | 8680737a802539f3c21a295ad45eb9be72c73f5f (patch) | |
tree | 337018ce1574f425847d5f1c089694f3e0996b1c /src/b_export.c | |
parent | Makefile update (diff) | |
download | 42-minishell-8680737a802539f3c21a295ad45eb9be72c73f5f.tar.gz 42-minishell-8680737a802539f3c21a295ad45eb9be72c73f5f.tar.bz2 42-minishell-8680737a802539f3c21a295ad45eb9be72c73f5f.tar.xz 42-minishell-8680737a802539f3c21a295ad45eb9be72c73f5f.tar.zst 42-minishell-8680737a802539f3c21a295ad45eb9be72c73f5f.zip |
More UNIX friendly libft
Diffstat (limited to 'src/b_export.c')
-rw-r--r-- | src/b_export.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/b_export.c b/src/b_export.c index 9fe5709..9a7c37d 100644 --- a/src/b_export.c +++ b/src/b_export.c @@ -64,28 +64,16 @@ static void while (msh->envp[i] != NULL) i++; if (!(nenvp = (char**)malloc((i + 2) * sizeof(char*)))) - { - lcom_clear(&msh->curr); - s_destroy(msh); - f_fail_alloc(msh); - } + f_fail_alloc_and_destroy(msh); i = 0; while (msh->envp[i] != NULL) { if (!(nenvp[i] = ft_strdup(msh->envp[i]))) - { - lcom_clear(&msh->curr); - s_destroy(msh); - f_fail_alloc(msh); - } + f_fail_alloc_and_destroy(msh); i++; } if (!(nenvp[i] = ft_strdup(var))) - { - lcom_clear(&msh->curr); - s_destroy(msh); - f_fail_alloc(msh); - } + f_fail_alloc_and_destroy(msh); nenvp[i + 1] = 0; ft_delwords(msh->envp); lvars_delone(&msh->vars, varname); |