Fixed coverity issue 1047599

This commit is contained in:
Armin Novak 2013-08-28 17:44:35 +02:00
parent 4bd1c567bd
commit e2cd11332b

View File

@ -43,20 +43,21 @@ char* NTLM_PACKAGE_NAME = "NTLM";
void ntlm_SetContextWorkstation(NTLM_CONTEXT* context, char* Workstation)
{
char *ws = Workstation;
DWORD nSize = 0;
if (!Workstation)
{
GetComputerNameExA(ComputerNameNetBIOS, NULL, &nSize);
Workstation = malloc(nSize);
ws = malloc(nSize);
GetComputerNameExA(ComputerNameNetBIOS, Workstation, &nSize);
}
context->Workstation.Length = ConvertToUnicode(CP_UTF8, 0,
Workstation, -1, &context->Workstation.Buffer, 0) - 1;
ws, -1, &context->Workstation.Buffer, 0) - 1;
context->Workstation.Length *= 2;
if (nSize > 0)
if (!Workstation)
free(Workstation);
}