Skip to content

[43] color-device: Don't close lcms profile on error from cd_icc_load_handle

Jonas Ådahl requested to merge cherry-pick-ed12df10 into gnome-43

As implemented in colord 1.4.6, cd_icc_load_handle() has three possible results:

  1. success, taking ownership of the profile;
  2. failure because cmsGetProfileContextID returns NULL, not taking ownership of the profile;
  3. failure in cd_icc_load(), taking ownership of the profile.

The previous commit ensures that we are not in case 2.

In case 3 where cd_icc_load() fails, ownership was already given to the colord CdIcc object, so it will be freed when the g_autoptr unrefs the CdIcc, and we must not free it again: that would be a double-free, potentially resulting in memory corruption.

Resolves: #2659 (closed) Signed-off-by: Simon McVittie smcv@debian.org Part-of: !2877 (merged)

(cherry picked from commit ed12df10)

Merge request reports