1
0
forked from aniani/vim

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)
This commit is contained in:
K.Takata
2022-02-12 11:18:37 +00:00
committed by Bram Moolenaar
parent 18f7593e57
commit d68b2fc034
8 changed files with 79 additions and 31 deletions

View File

@@ -520,7 +520,7 @@ unescape_shellxquote(char_u *p, char_u *escaped)
* Load library "name".
*/
HINSTANCE
vimLoadLib(char *name)
vimLoadLib(const char *name)
{
HINSTANCE dll = NULL;
@@ -8279,15 +8279,20 @@ resize_console_buf(void)
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;
}