]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_doswin: clear pointer when thread takes ownership
authorDaniel Stenberg <daniel@haxx.se>
Tue, 25 Nov 2025 09:14:28 +0000 (10:14 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 25 Nov 2025 09:59:37 +0000 (10:59 +0100)
Attempt to address #19675
Closes #19689

src/tool_doswin.c

index 6204296a8b519527fa6f2b3b1ac50544d812d11f..cd0ec3b9c1b1e4b188ecf4f7f248c1931f7e0872 100644 (file)
@@ -801,10 +801,7 @@ ThreadCleanup:
   if(socket_w != CURL_SOCKET_BAD)
     sclose(socket_w);
 
-  if(tdata) {
-    free(tdata);
-  }
-
+  free(tdata);
   return 0;
 }
 
@@ -884,6 +881,7 @@ curl_socket_t win32_stdin_read_thread(void)
       errorf("CreateThread error: 0x%08lx", GetLastError());
       break;
     }
+    tdata = NULL; /* win_stdin_thread_func owns it now */
 
     /* Connect to the thread and rearrange our own STDIN handles */
     socket_r = CURL_SOCKET(AF_INET, SOCK_STREAM, IPPROTO_TCP);