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
Init_tools_env function
i commented it out for now but you need to see how to fix this