diff --git a/src/tool_doswin.c b/src/tool_doswin.c index 6333464460..390d0aba91 100644 --- a/src/tool_doswin.c +++ b/src/tool_doswin.c @@ -730,7 +730,6 @@ static DWORD WINAPI win_stdin_thread_func(void *thread_data) { (void)thread_data; - atexit(cleanup_tdata); for(;;) { DWORD n; @@ -834,6 +833,12 @@ curl_socket_t win32_stdin_read_thread(void) curl_socklen_t socksize = 0; struct sockaddr_in selfaddr; + /* prevent mem leak warnings */ + if(atexit(&cleanup_tdata)) { + errorf("atexit() error"); + break; + } + /* Create the listening socket. It is used to create the writing socket by * accepting a connection from the reading socket. */ socket_l = CURL_SOCKET(AF_INET, SOCK_STREAM, IPPROTO_TCP);