[glib: 1/2] gparamspecs: Fix type class leaks on error handling paths



commit 1a3bba4670e79f9e78fae512ace9191226715e35
Author: Philip Withnall <withnall endlessm com>
Date:   Mon Oct 28 14:57:33 2019 +0000

    gparamspecs: Fix type class leaks on error handling paths
    
    Signed-off-by: Philip Withnall <withnall endlessm com>
    
    Helps: #1911

 gobject/gparamspecs.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gobject/gparamspecs.c b/gobject/gparamspecs.c
index 5d15c26e1..490c7c219 100644
--- a/gobject/gparamspecs.c
+++ b/gobject/gparamspecs.c
@@ -2092,7 +2092,10 @@ g_param_spec_enum (const gchar *name,
                                 blurb,
                                 flags);
   if (espec == NULL)
-    return NULL;
+    {
+      g_type_class_unref (enum_class);
+      return NULL;
+    }
   
   espec->enum_class = enum_class;
   espec->default_value = default_value;
@@ -2140,7 +2143,10 @@ g_param_spec_flags (const gchar *name,
                                 blurb,
                                 flags);
   if (fspec == NULL)
-    return NULL;
+    {
+      g_type_class_unref (flags_class);
+      return NULL;
+    }
   
   fspec->flags_class = flags_class;
   fspec->default_value = default_value;


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