From 4a33e7c0b46f0c8d940bd2bafbe60b114428413e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 3 Mar 2023 10:12:49 +0100 Subject: lib/icc: Always close profile when loading fails cd_icc_load() always takes ownership of the passed profile, but will leak it if the initial condition fails and the funtion returns an error. Only if the actual profile loading fails, will the passed profile eventually not be leaked. Fix this by closing it immediately in the first case. --- lib/colord/cd-icc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/colord/cd-icc.c b/lib/colord/cd-icc.c index ff685ef..39e2ac1 100644 --- a/lib/colord/cd-icc.c +++ b/lib/colord/cd-icc.c @@ -2099,6 +2099,7 @@ cd_icc_load_handle (CdIcc *icc, /* check the THR version has been correctly set up */ context = cmsGetProfileContextID (handle); if (context == NULL) { + cmsCloseProfile (handle); g_set_error_literal (error, CD_ICC_ERROR, CD_ICC_ERROR_FAILED_TO_CREATE, -- cgit v1.2.1