[gimp] modules: plug leak in color-selector-cmyk



commit fa070d4cf9de2107a0c3f84497b079059b624342
Author: Michael Natterer <mitch gimp org>
Date:   Mon Oct 6 20:29:58 2014 +0200

    modules: plug leak in color-selector-cmyk
    
    Don't leak the RGB profile if the CMYK profile can't be loaded

 modules/color-selector-cmyk.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/modules/color-selector-cmyk.c b/modules/color-selector-cmyk.c
index 5906fad..f7dedcb 100644
--- a/modules/color-selector-cmyk.c
+++ b/modules/color-selector-cmyk.c
@@ -372,11 +372,11 @@ color_config_get_cmyk_profile (GimpColorConfig *config)
 static void
 colorsel_cmyk_config_changed (ColorselCmyk *module)
 {
-  GimpColorSelector *selector = GIMP_COLOR_SELECTOR (module);
-  GimpColorConfig   *config   = module->config;
-  cmsUInt32Number    flags    = 0;
-  cmsHPROFILE        rgb_profile;
-  cmsHPROFILE        cmyk_profile;
+  GimpColorSelector *selector     = GIMP_COLOR_SELECTOR (module);
+  GimpColorConfig   *config       = module->config;
+  cmsUInt32Number    flags        = 0;
+  cmsHPROFILE        rgb_profile  = NULL;
+  cmsHPROFILE        cmyk_profile = NULL;
   gchar             *label;
   gchar             *summary;
   gchar             *text;
@@ -431,10 +431,14 @@ colorsel_cmyk_config_changed (ColorselCmyk *module)
                                          config->display_intent,
                                          flags);
 
-  cmsCloseProfile (rgb_profile);
-  cmsCloseProfile (cmyk_profile);
-
  out:
+
+  if (rgb_profile)
+    cmsCloseProfile (rgb_profile);
+
+  if (cmyk_profile)
+    cmsCloseProfile (cmyk_profile);
+
   if (! module->in_destruction)
     colorsel_cmyk_set_color (selector, &selector->rgb, &selector->hsv);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]