Marcus Meissner : advapi32: Free wstr in error case to avoid leak (Coverity ).

Alexandre Julliard julliard at winehq.org
Wed Oct 3 13:20:36 CDT 2012


Module: wine
Branch: master
Commit: 91a767d75b12d67cabfebeb22b7cf176c8b6e4b0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=91a767d75b12d67cabfebeb22b7cf176c8b6e4b0

Author: Marcus Meissner <marcus at jet.franken.de>
Date:   Wed Oct  3 16:21:35 2012 +0200

advapi32: Free wstr in error case to avoid leak (Coverity).

---

 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 8b60dd6..c86ca17 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);




More information about the wine-cvs mailing list