summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <withnall@endlessm.com>2019-10-28 14:57:33 +0000
committerPhilip Withnall <withnall@endlessm.com>2019-10-28 14:57:33 +0000
commit1a3bba4670e79f9e78fae512ace9191226715e35 (patch)
tree1628d9e2accfc857a4a4c5b0e29992991a3532f1
parent1bebba043092a8cdfeb01d91f11828894ea13b80 (diff)
downloadglib-1a3bba4670e79f9e78fae512ace9191226715e35.tar.gz
gparamspecs: Fix type class leaks on error handling paths
Signed-off-by: Philip Withnall <withnall@endlessm.com> Helps: #1911
-rw-r--r--gobject/gparamspecs.c10
1 files 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;