Naji-k / minishell

1 stars 0 forks source link

OLD_PWD leak #92

Closed srondss closed 1 year ago

srondss commented 1 year ago

Init_tools_env function

    cur = find_env_by_key(env_list, "OLDPWD");
    if (cur)
    {
        cur->has_value = false;
        cur->value = NULL; // THIS IS CAUSING LEAK because OLDPWD already has ft_substr in env_new_node function and then you set it to null and the old malloced string is lost.
    }

i commented it out for now but you need to see how to fix this