From 747951fd8e5fb926555adb349b02b70c1f6474ef Mon Sep 17 00:00:00 2001 From: Vitaly Lipatov Date: Fri, 30 Oct 2026 09:29:55 +0300 Subject: [PATCH 1/2] lib: Fix a CdIcc leak when a profile file is deleted cd_icc_store_find_by_filename() returns a new reference, but the G_FILE_MONITOR_EVENT_DELETED handler never dropped it. Every deleted profile file therefore leaked the CdIcc object together with the profile data, so the daemon grew by about the size of the file each time a file in a watched directory was removed, e.g. on every package reinstall. Fixes: https://github.com/hughsie/colord/issues/218 Co-Authored-By: Claude Opus 5.5 --- lib/colord/cd-icc-store.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/colord/cd-icc-store.c b/lib/colord/cd-icc-store.c index f626073..eb6e45f 100644 --- a/lib/colord/cd-icc-store.c +++ b/lib/colord/cd-icc-store.c @@ -299,7 +299,7 @@ cd_icc_store_file_monitor_changed_cb (GFileMonitor *monitor, CdIccStore *store) { CdIccStorePrivate *priv = GET_PRIVATE (store); - CdIcc *tmp; + g_autoptr(CdIcc) tmp = NULL; CdIccStoreDirHelper *helper; g_autofree gchar *path = NULL; -- 2.50.1 From 35e80353d94761612ccfe33d48a63841ca8d7086 Mon Sep 17 00:00:00 2001 From: Vitaly Lipatov Date: Fri, 30 Oct 2026 09:30:04 +0300 Subject: [PATCH 2/2] Unexport the profile when its ICC file is removed cd_profile_array_get_by_filename() returns a new reference, but cd_main_icc_store_removed_cb() never dropped it. The CdProfile was never finalized, so its D-Bus object stayed exported after the file was deleted, and re-creating the same file failed with: CdMain: failed to emit ProfileAdded: failed to register object: An object is already exported for the interface org.freedesktop.ColorManager.Profile at .../profiles/icc_ Also drop the profile from the array when registering it on the bus fails, so that a failed add no longer leaves an unexported profile behind for the lifetime of the daemon. Fixes: https://github.com/hughsie/colord/issues/218 Co-Authored-By: Claude Opus 5.5 --- src/cd-main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cd-main.c b/src/cd-main.c index ec7b842..2d8a326 100644 --- a/src/cd-main.c +++ b/src/cd-main.c @@ -1656,6 +1656,7 @@ cd_main_icc_store_added_cb (CdIccStore *icc_store, if (!ret) { g_warning ("CdMain: failed to emit ProfileAdded: %s", error->message); + cd_profile_array_remove (priv->profiles_array, profile); return; } } @@ -1666,7 +1667,7 @@ cd_main_icc_store_removed_cb (CdIccStore *icc_store, gpointer user_data) { CdMainPrivate *priv = (CdMainPrivate *) user_data; - CdProfile *profile; + g_autoptr(CdProfile) profile = NULL; /* check the profile should be invalidated automatically */ profile = cd_profile_array_get_by_filename (priv->profiles_array, -- 2.50.1