mirror of
https://github.com/curl/curl.git
synced 2026-08-25 01:33:31 +03:00
windows: fix issues detected by clang-tidy, and some more
- digest_sspi: memory leak.
- digest_sspi: free buffers on `calloc()` fail.
(not detected by clang-tidy)
- schannel_verify: avoid a `NULL` `alt_name_info`.
- schannel: fix potential `NULL` deref for `backend->cred`.
- schannel: fix uninitialized result value.
Follow-up to 7f4c358541 #3197
- schannel: drop unused assigment.
- tool_doswin: drop unused assigment.
- testutil: fix memory leak on error.
- testutil: fix memory leak on non-error.
(not detected by clang-tidy)
Cherry-picked from #16764
Closes #16777
This commit is contained in:
parent
c48c4914a9
commit
554e4c14be
5 changed files with 19 additions and 6 deletions
|
|
@ -141,6 +141,7 @@ HMODULE win32_load_system_library(const TCHAR *filename)
|
|||
size_t systemdirlen = GetSystemDirectory(NULL, 0);
|
||||
size_t written;
|
||||
TCHAR *path;
|
||||
HMODULE module;
|
||||
|
||||
if(!filenamelen || filenamelen > 32768 ||
|
||||
!systemdirlen || systemdirlen > 32768)
|
||||
|
|
@ -153,15 +154,21 @@ HMODULE win32_load_system_library(const TCHAR *filename)
|
|||
|
||||
/* if written >= systemdirlen then nothing was written */
|
||||
written = GetSystemDirectory(path, (unsigned int)systemdirlen);
|
||||
if(!written || written >= systemdirlen)
|
||||
if(!written || written >= systemdirlen) {
|
||||
free(path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(path[written - 1] != _T('\\'))
|
||||
path[written++] = _T('\\');
|
||||
|
||||
_tcscpy(path + written, filename);
|
||||
|
||||
return LoadLibrary(path);
|
||||
module = LoadLibrary(path);
|
||||
|
||||
free(path);
|
||||
|
||||
return module;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue