From 4e4c150bede97661345c67d3ae15eb81f80feefd Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 30 Jul 2007 23:37:39 +0200 Subject: [PATCH] ntdll: Avoid activation context leak for dlls with no imports. --- dlls/ntdll/loader.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 09516f6706c..a37394decf8 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -625,8 +625,6 @@ static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path ) if (!(wm->ldr.Flags & LDR_DONT_RESOLVE_REFS)) return STATUS_SUCCESS; /* already done */ wm->ldr.Flags &= ~LDR_DONT_RESOLVE_REFS; - if (!create_module_activation_context( &wm->ldr )) - RtlActivateActivationContext( 0, wm->ldr.ActivationContext, &cookie ); if (!(imports = RtlImageDirectoryEntryToData( wm->ldr.BaseAddress, TRUE, IMAGE_DIRECTORY_ENTRY_IMPORT, &size ))) @@ -637,6 +635,9 @@ static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path ) if (!nb_imports) return STATUS_SUCCESS; /* no imports */ + if (!create_module_activation_context( &wm->ldr )) + RtlActivateActivationContext( 0, wm->ldr.ActivationContext, &cookie ); + /* Allocate module dependency list */ wm->nDeps = nb_imports; wm->deps = RtlAllocateHeap( GetProcessHeap(), 0, nb_imports*sizeof(WINE_MODREF *) );