patch 8.2.4354: dynamic loading of libsodium not handled properly

Problem:    Dynamic loading of libsodium not handled properly.
Solution:   Fix has() and :version. Show an error message when loading fails.
            Fix memory leaks. (Ken Takata, closes #9754)
diff --git a/src/os_win32.c b/src/os_win32.c
index 682fdf2..fbf6665 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -520,7 +520,7 @@
  * Load library "name".
  */
     HINSTANCE
-vimLoadLib(char *name)
+vimLoadLib(const char *name)
 {
     HINSTANCE	dll = NULL;
 
@@ -8279,15 +8279,20 @@
     char *
 GetWin32Error(void)
 {
+    static char *oldmsg = NULL;
     char *msg = NULL;
+
     FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
 	    NULL, GetLastError(), 0, (LPSTR)&msg, 0, NULL);
+    if (oldmsg != NULL)
+	LocalFree(oldmsg);
     if (msg != NULL)
     {
 	// remove trailing \r\n
 	char *pcrlf = strstr(msg, "\r\n");
 	if (pcrlf != NULL)
 	    *pcrlf = '\0';
+	oldmsg = msg;
     }
     return msg;
 }