glib2/backport-gparamspecs-Fix-type-class-leaks-on-error-handling-paths.patch
shirely16 a3d31ddf3c synchronous community patch
(cherry picked from commit 5fb95aa15490a21b390e53a88c1b8b052971e504)
2021-05-21 15:56:45 +08:00

50 lines
1.3 KiB
Diff

From 1a3bba4670e79f9e78fae512ace9191226715e35 Mon Sep 17 00:00:00 2001
From: Philip Withnall <withnall@endlessm.com>
Date: Mon, 28 Oct 2019 14:57:33 +0000
Subject: [PATCH 0078/1095] gparamspecs: Fix type class leaks on error handling
paths
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Helps: #1911
reason: Fix type class leaks on error handling paths
Conflict:NA
Reference:https://github.com/GNOME/glib/commit/1a3bba4670e79f9e78fae512ace9191226715e35
---
gobject/gparamspecs.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/gobject/gparamspecs.c b/gobject/gparamspecs.c
index 5d15c26..490c7c2 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;
--
1.8.3.1