[glade/tintou/gladepropertyclass-leak] gladeui: Fix leak of create_type in GladePropertyClass
- From: Corentin Noël <corentinnoel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade/tintou/gladepropertyclass-leak] gladeui: Fix leak of create_type in GladePropertyClass
- Date: Mon, 1 Apr 2019 09:41:14 +0000 (UTC)
commit bacc258a103f7e0a9937bca03bd2f39e27ab39df
Author: Corentin Noël <corentin noel collabora com>
Date: Mon Apr 1 11:40:19 2019 +0200
gladeui: Fix leak of create_type in GladePropertyClass
gladeui/glade-property-class.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/gladeui/glade-property-class.c b/gladeui/glade-property-class.c
index caa62fd8..9e68b759 100644
--- a/gladeui/glade-property-class.c
+++ b/gladeui/glade-property-class.c
@@ -230,6 +230,7 @@ glade_property_class_new (GladeWidgetAdaptor *adaptor,
property_class->transfer_on_paste = FALSE;
property_class->weight = -1.0;
property_class->parentless_widget = FALSE;
+ property_class->create_type = NULL;
/* Initialize property versions & deprecated to adaptor */
property_class->version_since_major = GWA_VERSION_SINCE_MAJOR (adaptor);
@@ -285,6 +286,10 @@ glade_property_class_clone (GladePropertyClass *property_class,
g_value_copy (property_class->orig_def, clone->orig_def);
}
+ if (property_class->create_type) {
+ clone->create_type = g_strdup (property_class->create_type);
+ }
+
return clone;
}
@@ -302,22 +307,23 @@ glade_property_class_free (GladePropertyClass * property_class)
g_return_if_fail (GLADE_IS_PROPERTY_CLASS (property_class));
- g_free (property_class->id);
- g_free (property_class->tooltip);
- g_free (property_class->name);
+ g_clear_pointer (&property_class->id, g_free);
+ g_clear_pointer (&property_class->name, g_free);
+ g_clear_pointer (&property_class->tooltip, g_free);
if (property_class->orig_def)
{
if (G_VALUE_TYPE (property_class->orig_def) != 0)
g_value_unset (property_class->orig_def);
- g_free (property_class->orig_def);
+ g_clear_pointer (&property_class->orig_def, g_free);
}
if (property_class->def)
{
if (G_VALUE_TYPE (property_class->def) != 0)
g_value_unset (property_class->def);
- g_free (property_class->def);
+ g_clear_pointer (&property_class->def, g_free);
}
+ g_clear_pointer (&property_class->create_type, g_free);
g_slice_free (GladePropertyClass, property_class);
}
@@ -2160,8 +2166,7 @@ glade_property_class_update_from_node (GladeXmlNode *node,
if ((buf = glade_xml_get_property_string
(node, GLADE_TAG_CREATE_TYPE)) != NULL)
{
- if (klass->create_type)
- g_free (klass->create_type);
+ g_clear_pointer (&klass->create_type, g_free);
klass->create_type = buf;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]