Hi Hans.

On 12/21/09 11:14 AM, Hans Leidekker wrote:
Found by Valgrind.
---
  dlls/wininet/internet.c |    6 +++++-
  1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index d749e53..2b8d767 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -3127,8 +3127,12 @@ static DWORD CALLBACK INTERNET_WorkerThreadFunc(LPVOID 
lpvParam)
      HeapFree(GetProcessHeap(), 0, lpRequest);

      workRequest.asyncproc(&workRequest);
-
      WININET_Release( workRequest.hdr );
+
+    if (g_dwTlsErrIndex != TLS_OUT_OF_INDEXES)
+    {
+        HeapFree(GetProcessHeap(), 0, TlsGetValue(g_dwTlsErrIndex));
+    }

You have to set TLS value to NULL otherwise it will crash on next INTERNET_SetLastError in the same thread on another async call. But the right way to fix this is to get rid of INTERNET_[GS]etLastError. This is useless and has proven to result in code that has many failure paths without last error set. I've already removed most of these calls and I'm near to getting rid of all of them except ones in ftp.c.

Thanks,
    Jacek


Reply via email to