From 1226dcfbbaad30d1808f5595e6e71f798a15ffeb Mon Sep 17 00:00:00 2001 From: narnaud Date: Tue, 24 May 2022 08:09:53 +0200 Subject: [PATCH] norminage --- lexer_2.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lexer_2.c b/lexer_2.c index 7d30612..60641c4 100644 --- a/lexer_2.c +++ b/lexer_2.c @@ -6,7 +6,7 @@ /* By: mea +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/05/16 07:53:17 by narnaud #+# #+# */ -/* Updated: 2022/05/18 14:44:03 by narnaud@stude ### ########.fr */ +/* Updated: 2022/05/24 08:06:11 by narnaud ### ########.fr */ /* */ /* ************************************************************************** */ @@ -75,18 +75,15 @@ char *get_var_value(t_datas *datas, char *line, int name_len) if (!ft_strncmp(name, env[0], name_len + 1)) { if (env[1]) - value = env[1]; + value = ft_strdup(env[1]); else value = ft_strdup(""); - free(env[0]); } - else if (++i) - ft_free_split(env); + ++i; + ft_free_split(env); } free(name); - if (value) - free(env); - else + if (!value) value = ft_strdup(""); return (value); }