Fixed memory leak.

This commit is contained in:
Armin Novak 2018-01-24 14:11:33 +01:00
parent 32cc6e16ef
commit 60ab8cc724

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,