fix: invalid write fix

This commit is contained in:
Camille Chauvet 2023-03-28 15:51:12 +02:00
parent 8a6a0012dc
commit 9787d71b85

9
env/env_fill.c vendored
View File

@ -6,12 +6,11 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/16 16:29:08 by cchauvet #+# #+# */
/* Updated: 2023/02/20 15:39:28 by starnakin ### ########.fr */
/* Updated: 2023/03/27 16:42:27 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "./env_private.h"
#include "env.h"
static char *ft_getkey(const char *str)
{
@ -97,13 +96,13 @@ char *ft_env_filler(t_data *data, const char *str)
return (NULL);
temp = ft_strreplace(out, value, i, key_len + i);
i = i + ft_strlen(value);
free(out);
free(value);
ft_freer_ultimate(2, value, out);
if (temp == NULL)
return (NULL);
out = temp;
}
i++;
if (out[i] != '\0')
i++;
}
return (out);
}