Fixed memory leak.

This commit is contained in:
Armin Novak 2014-11-16 17:21:36 +01:00
parent 831b74d519
commit abeb29213f

View File

@ -355,11 +355,17 @@ LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge)
while ((offset + length + 8) > cchEnvironmentBlock)
{
LPCH tmp;
cchEnvironmentBlock *= 2;
lpszEnvironmentBlock = (LPCH) realloc(lpszEnvironmentBlock, cchEnvironmentBlock * sizeof(CHAR));
tmp = (LPCH) realloc(lpszEnvironmentBlock, cchEnvironmentBlock * sizeof(CHAR));
if (!lpszEnvironmentBlock)
if (!tmp)
{
if (lpszEnvironmentBlock)
free (lpszEnvironmentBlock);
return NULL;
}
lpszEnvironmentBlock = tmp;
}
p = &(lpszEnvironmentBlock[offset]);