From: Alex Henrie alexhenrie24@gmail.com
--- dlls/setupapi/misc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/dlls/setupapi/misc.c b/dlls/setupapi/misc.c index f9d34b5353d..5a4b899dc9d 100644 --- a/dlls/setupapi/misc.c +++ b/dlls/setupapi/misc.c @@ -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,