>From b0f392c37ac1522ea7abe5139a0c066db53773be Mon Sep 17 00:00:00 2001
From: YX Hao <lifenjoiner@163.com>
Date: Mon, 27 Nov 2017 21:57:46 +0800
Subject: Call WSACleanup for Windows when Sockets finished


diff --git a/src/main.c b/src/main.c
index ff0616ba..f8c4a8d6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2246,6 +2246,10 @@ only if outputting to a regular file.\n"));
   if ((opt.convert_links || opt.convert_file_only) && !opt.delete_after)
     convert_all_links ();
 
+#ifdef WINDOWS
+  ws_cleanup ();
+#endif
+
   cleanup ();
 
   exit (get_exit_status ());
diff --git a/src/mswindows.c b/src/mswindows.c
index f7e03bdd..ac684ae5 100644
--- a/src/mswindows.c
+++ b/src/mswindows.c
@@ -83,7 +83,7 @@ windows_main (char **exec_name)
     *p = '\0';
 }
 
-static void
+void
 ws_cleanup (void)
 {
   xfree (exec_name);
diff --git a/src/mswindows.h b/src/mswindows.h
index 1bc2e217..f92b2470 100644
--- a/src/mswindows.h
+++ b/src/mswindows.h
@@ -94,6 +94,7 @@ typedef __int64 wgint;
 /* Public functions.  */
 
 void ws_startup (void);
+void ws_cleanup (void);
 void ws_changetitle (const char *);
 void ws_percenttitle (double);
 char *ws_mypath (void);
