Merge pull request #4379 from akallabeth/memleak_fix

Fixed memory leak.
This commit is contained in:
Bernhard Miklautz 2018-01-24 15:57:33 +01:00 committed by GitHub
commit f0a1e73098
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -351,6 +351,7 @@ void sspi_SecureHandleFree(SecHandle* handle)
int sspi_SetAuthIdentity(SEC_WINNT_AUTH_IDENTITY* identity, const char* user, const char* domain,
const char* password)
{
int rc;
int unicodePasswordLenW;
LPWSTR unicodePassword = NULL;
unicodePasswordLenW = ConvertToUnicode(CP_UTF8, 0, password, -1, &unicodePassword, 0);
@ -358,8 +359,10 @@ int sspi_SetAuthIdentity(SEC_WINNT_AUTH_IDENTITY* identity, const char* user, co
if (unicodePasswordLenW <= 0)
return -1;
return sspi_SetAuthIdentityWithUnicodePassword(identity, user, domain, unicodePassword,
rc = sspi_SetAuthIdentityWithUnicodePassword(identity, user, domain, unicodePassword,
(ULONG)(unicodePasswordLenW - 1));
free(unicodePassword);
return rc;
}
int sspi_SetAuthIdentityWithUnicodePassword(SEC_WINNT_AUTH_IDENTITY* identity, const char* user,