Nikolay Sivov : mscms: Free memory and handle on error path (Coverity).

Alexandre Julliard julliard at winehq.org
Mon Apr 1 13:48:40 CDT 2013


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sun Mar 31 12:25:12 2013 +0400

mscms: Free memory and handle on error path (Coverity).

---

 dlls/mscms/profile.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/dlls/mscms/profile.c b/dlls/mscms/profile.c
index b0ffce4..8444e14 100644
--- a/dlls/mscms/profile.c
+++ b/dlls/mscms/profile.c
@@ -1528,14 +1528,18 @@ HPROFILE WINAPI OpenColorProfileW( PPROFILE profile, DWORD access, DWORD sharing
     if (cmsprofile)
     {
         struct profile profile;
+        HPROFILE hprof;
 
         profile.file = handle;
         profile.access = access;
         profile.iccprofile = iccprofile;
         profile.cmsprofile = cmsprofile;
 
-        return create_profile( &profile );
+        if ((hprof = create_profile( &profile ))) return hprof;
+        HeapFree( GetProcessHeap(), 0, iccprofile );
+        cmsCloseProfile( cmsprofile );
     }
+    CloseHandle( handle );
 
 #endif /* HAVE_LCMS */
     return NULL;




More information about the wine-cvs mailing list