[PATCH] advapi32: free wstr in error case to avoid leak (Coverity)
Marcus Meissner
marcus at jet.franken.de
Wed Oct 3 09:21:35 CDT 2012
Hi,
CID 713322, wstr was leaking in errors.
Ciao, Marcus
---
dlls/advapi32/security.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c
index 4abd1f0..dae174f 100644
--- a/dlls/advapi32/security.c
+++ b/dlls/advapi32/security.c
@@ -4861,17 +4861,25 @@ BOOL WINAPI ConvertSecurityDescriptorToStringSecurityDescriptorW(PSECURITY_DESCR
wstr = wptr = LocalAlloc(0, (len + 1)*sizeof(WCHAR));
if (RequestedInformation & OWNER_SECURITY_INFORMATION)
- if (!DumpOwner(SecurityDescriptor, &wptr, NULL))
+ if (!DumpOwner(SecurityDescriptor, &wptr, NULL)) {
+ LocalFree (wstr);
return FALSE;
+ }
if (RequestedInformation & GROUP_SECURITY_INFORMATION)
- if (!DumpGroup(SecurityDescriptor, &wptr, NULL))
+ if (!DumpGroup(SecurityDescriptor, &wptr, NULL)) {
+ LocalFree (wstr);
return FALSE;
+ }
if (RequestedInformation & DACL_SECURITY_INFORMATION)
- if (!DumpDacl(SecurityDescriptor, &wptr, NULL))
+ if (!DumpDacl(SecurityDescriptor, &wptr, NULL)) {
+ LocalFree (wstr);
return FALSE;
+ }
if (RequestedInformation & SACL_SECURITY_INFORMATION)
- if (!DumpSacl(SecurityDescriptor, &wptr, NULL))
+ if (!DumpSacl(SecurityDescriptor, &wptr, NULL)) {
+ LocalFree (wstr);
return FALSE;
+ }
*wptr = 0;
TRACE("ret: %s, %d\n", wine_dbgstr_w(wstr), len);
--
1.7.3.4
More information about the wine-patches
mailing list