From 60ab8cc7249b1edf809d826f0f972b613ee08fd5 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Wed, 24 Jan 2018 14:11:33 +0100 Subject: [PATCH] Fixed memory leak. --- winpr/libwinpr/sspi/sspi_winpr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/winpr/libwinpr/sspi/sspi_winpr.c b/winpr/libwinpr/sspi/sspi_winpr.c index 13ed9d433..bad9992db 100644 --- a/winpr/libwinpr/sspi/sspi_winpr.c +++ b/winpr/libwinpr/sspi/sspi_winpr.c @@ -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,