Fixed memory leak.
This commit is contained in:
parent
be3df80c9c
commit
709435d6d7
@ -345,7 +345,10 @@ LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge)
|
|||||||
lpszEnvironmentBlock = (LPCH) malloc(cchEnvironmentBlock * sizeof(CHAR));
|
lpszEnvironmentBlock = (LPCH) malloc(cchEnvironmentBlock * sizeof(CHAR));
|
||||||
|
|
||||||
if (!lpszEnvironmentBlock)
|
if (!lpszEnvironmentBlock)
|
||||||
|
{
|
||||||
|
free (mergeStrings);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
envp = original;
|
envp = original;
|
||||||
|
|
||||||
@ -361,8 +364,8 @@ LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge)
|
|||||||
|
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
{
|
{
|
||||||
if (lpszEnvironmentBlock)
|
free (lpszEnvironmentBlock);
|
||||||
free (lpszEnvironmentBlock);
|
free (mergeStrings);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
lpszEnvironmentBlock = tmp;
|
lpszEnvironmentBlock = tmp;
|
||||||
@ -404,6 +407,7 @@ LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge)
|
|||||||
{
|
{
|
||||||
if (lpszEnvironmentBlock)
|
if (lpszEnvironmentBlock)
|
||||||
free(lpszEnvironmentBlock);
|
free(lpszEnvironmentBlock);
|
||||||
|
free (mergeStrings);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
lpszEnvironmentBlock = tmp;
|
lpszEnvironmentBlock = tmp;
|
||||||
@ -447,6 +451,7 @@ LPCH MergeEnvironmentStrings(PCSTR original, PCSTR merge)
|
|||||||
{
|
{
|
||||||
if (lpszEnvironmentBlock)
|
if (lpszEnvironmentBlock)
|
||||||
free(lpszEnvironmentBlock);
|
free(lpszEnvironmentBlock);
|
||||||
|
free (mergeStrings);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user