libc: Fix some environment-related bugs
This commit is contained in:
parent
411c6c40cd
commit
18130847c1
@ -54,10 +54,10 @@ static Result<void> _try_move_env()
|
|||||||
|
|
||||||
if (!env)
|
if (!env)
|
||||||
{
|
{
|
||||||
|
TRY(g_dynamic_env.try_append(nullptr));
|
||||||
guard.deactivate();
|
guard.deactivate();
|
||||||
env_is_dynamic = true;
|
env_is_dynamic = true;
|
||||||
environ = g_dynamic_env.data();
|
environ = g_dynamic_env.data();
|
||||||
check(!environ);
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,10 +109,12 @@ extern "C"
|
|||||||
{
|
{
|
||||||
if (element) free(element);
|
if (element) free(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_dynamic_env.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
env_is_dynamic = false;
|
|
||||||
environ = nullptr;
|
environ = nullptr;
|
||||||
|
env_is_dynamic = false;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user