fixed heredoc expansion
This commit is contained in:
@@ -57,13 +57,17 @@ void set_env(
|
||||
char *key;
|
||||
char *val;
|
||||
char *old_value;
|
||||
bool owns_key;
|
||||
|
||||
environment = minishell->variables.environment;
|
||||
owns_key = false;
|
||||
key = (char *)name;
|
||||
if (name != NULL && !ft_hashmap_contains_key(environment, name))
|
||||
{
|
||||
key = ft_strdup(name);
|
||||
if (key == NULL)
|
||||
return (minishell->exit = true, malloc_error());
|
||||
owns_key = true;
|
||||
}
|
||||
if (value == NULL)
|
||||
val = ft_strdup("");
|
||||
@@ -71,7 +75,7 @@ void set_env(
|
||||
val = ft_strdup(value);
|
||||
if (val == NULL)
|
||||
{
|
||||
if (key != name)
|
||||
if (owns_key)
|
||||
free(key);
|
||||
return (minishell->exit = true, malloc_error());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user