Commit 00205754 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

setupapi: Fix memory leak on realloc failure in RetreiveFileSecurity.

parent 7077c5bc
......@@ -740,7 +740,7 @@ fail:;
DWORD WINAPI RetreiveFileSecurity(LPCWSTR lpFileName,
PSECURITY_DESCRIPTOR *pSecurityDescriptor)
{
PSECURITY_DESCRIPTOR SecDesc;
SECURITY_DESCRIPTOR *SecDesc, *NewSecDesc;
DWORD dwSize = 0x100;
DWORD dwError;
......@@ -763,9 +763,13 @@ DWORD WINAPI RetreiveFileSecurity(LPCWSTR lpFileName,
return dwError;
}
SecDesc = MyRealloc(SecDesc, dwSize);
if (SecDesc == NULL)
NewSecDesc = MyRealloc(SecDesc, dwSize);
if (NewSecDesc == NULL)
{
MyFree(SecDesc);
return ERROR_NOT_ENOUGH_MEMORY;
}
SecDesc = NewSecDesc;
if (GetFileSecurityW(lpFileName, OWNER_SECURITY_INFORMATION |
GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment