mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
ntdll: Avoid leaking the previous environment in RtlSetCurrentEnvironment().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d98b87a317
commit
e012bd5811
1 changed files with 8 additions and 1 deletions
|
@ -996,14 +996,21 @@ NTSTATUS WINAPI RtlQueryEnvironmentVariable_U(PWSTR env,
|
|||
*/
|
||||
void WINAPI RtlSetCurrentEnvironment(PWSTR new_env, PWSTR* old_env)
|
||||
{
|
||||
WCHAR *prev;
|
||||
|
||||
TRACE("(%p %p)\n", new_env, old_env);
|
||||
|
||||
RtlAcquirePebLock();
|
||||
|
||||
if (old_env) *old_env = NtCurrentTeb()->Peb->ProcessParameters->Environment;
|
||||
prev = NtCurrentTeb()->Peb->ProcessParameters->Environment;
|
||||
NtCurrentTeb()->Peb->ProcessParameters->Environment = new_env;
|
||||
|
||||
RtlReleasePebLock();
|
||||
|
||||
if (old_env)
|
||||
*old_env = prev;
|
||||
else
|
||||
RtlDestroyEnvironment( prev );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue