summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ã…dahl <jadahl@gmail.com>2023-03-03 10:12:49 +0100
committerRichard Hughes <richard@hughsie.com>2023-03-03 10:50:34 +0000
commit4a33e7c0b46f0c8d940bd2bafbe60b114428413e (patch)
treed1df1f3e7a9f3bc65dbf9b0941e378747b551e61
parent91a3cc2e994be587def3b70762f15461101d43a1 (diff)
downloadcolord-4a33e7c0b46f0c8d940bd2bafbe60b114428413e.tar.gz
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.
-rw-r--r--lib/colord/cd-icc.c1
1 files changed, 1 insertions, 0 deletions
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,