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;