[ACGENRAL] Don't leak memory on failure in InitIgnoreFreeLibrary()

CID 1441306
This commit is contained in:
Pierre Schweitzer 2018-11-16 22:02:46 +01:00
parent 52da844825
commit 007cc5cd8a
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B

View file

@ -97,7 +97,7 @@ static VOID InitIgnoreFreeLibrary(PCSTR CommandLine)
if (!names[n])
{
SHIM_WARN("Unable to allocate %u bytes\n", cur - prev + 2);
return;
goto fail;
}
n++;
prev = cur + 1;
@ -106,11 +106,23 @@ static VOID InitIgnoreFreeLibrary(PCSTR CommandLine)
if (!names[n])
{
SHIM_WARN("Unable to allocate last string\n");
return;
goto fail;
}
g_Names = names;
g_NameCount = count;
return;
fail:
--n;
while (n >= 0)
{
if (names[n])
ShimLib_ShimFree((PVOID)names[n]);
--n;
}
ShimLib_ShimFree(names);
}
BOOL WINAPI SHIM_OBJ_NAME(Notify)(DWORD fdwReason, PVOID ptr)