diff --git a/src/subst/variable_subst.c b/src/subst/variable_subst.c index 795aea1..4d32dda 100644 --- a/src/subst/variable_subst.c +++ b/src/subst/variable_subst.c @@ -6,7 +6,7 @@ /* By: khais +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/03/19 17:28/29 by khais #+# #+# */ -/* Updated: 2025/03/21 17:38:16 by jguelen ### ########.fr */ +/* Updated: 2025/03/24 10:47:12 by jguelen ### ########.fr */ /* */ /* ************************************************************************** */ @@ -93,6 +93,7 @@ static char *calculate_replacement(t_worddesc *word, t_minishell *app, size_t i, *id_len = ft_strlen(id); if (*id_len == 0 && word->word[i + 1] == '?') { + *id_len = 1; rep = expand_question_mark(app); if (!rep) return (NULL); @@ -107,8 +108,7 @@ static char *calculate_replacement(t_worddesc *word, t_minishell *app, size_t i, if (!rep) return (NULL); } - free(id); - return (rep); + return (free(id), rep); } /*