- Fix dereference of freed memory
authorCameron Gutman <aicommander@gmail.com>
Tue, 18 Aug 2009 19:06:52 +0000 (19:06 +0000)
committerCameron Gutman <aicommander@gmail.com>
Tue, 18 Aug 2009 19:06:52 +0000 (19:06 +0000)
svn path=/trunk/; revision=42772

reactos/dll/win32/ws2help/handle.c

index cc76e73..e34de90 100644 (file)
@@ -65,6 +65,7 @@ CALLBACK
 ExitThreadApc(ULONG_PTR Context)
 {
     PWAH_HELPER_CONTEXT HelperContext = (PWAH_HELPER_CONTEXT)Context;
 ExitThreadApc(ULONG_PTR Context)
 {
     PWAH_HELPER_CONTEXT HelperContext = (PWAH_HELPER_CONTEXT)Context;
+    HMODULE DllHandle = HelperContext->DllHandle;
 
     /* Close the file handle */
     CloseHandle(HelperContext->FileHandle);
 
     /* Close the file handle */
     CloseHandle(HelperContext->FileHandle);
@@ -73,7 +74,7 @@ ExitThreadApc(ULONG_PTR Context)
     HeapFree(GlobalHeap, 0, HelperContext);
 
     /* Exit the thread and library */
     HeapFree(GlobalHeap, 0, HelperContext);
 
     /* Exit the thread and library */
-    FreeLibraryAndExitThread(HelperContext->DllHandle, ERROR_SUCCESS);
+    FreeLibraryAndExitThread(DllHandle, ERROR_SUCCESS);
 }
 
 DWORD
 }
 
 DWORD