From 3f3404d2487129db7da6ec5372b7158304292f5e Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Sun, 31 Mar 2013 12:25:12 +0400 Subject: [PATCH] mscms: Free memory and handle on error path (Coverity). --- dlls/mscms/profile.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/mscms/profile.c b/dlls/mscms/profile.c index b0ffce45777..8444e14ef35 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;