[evolution] Correct memory leak of object returned by atk_object_ref_relation_set()
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Correct memory leak of object returned by atk_object_ref_relation_set()
- Date: Tue, 26 Jun 2018 12:54:02 +0000 (UTC)
commit 248cb45e0b17fad9d7f988fb558e03d11b0dfaea
Author: Milan Crha <mcrha redhat com>
Date: Tue Jun 26 14:55:10 2018 +0200
Correct memory leak of object returned by atk_object_ref_relation_set()
src/calendar/gui/e-timezone-entry.c | 8 +++++++-
src/e-util/e-dateedit.c | 8 +++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/calendar/gui/e-timezone-entry.c b/src/calendar/gui/e-timezone-entry.c
index 6ef670f686..725780a1f3 100644
--- a/src/calendar/gui/e-timezone-entry.c
+++ b/src/calendar/gui/e-timezone-entry.c
@@ -130,10 +130,14 @@ timezone_entry_add_relation (ETimezoneEntry *timezone_entry)
relation = atk_relation_set_get_relation_by_type (
set, ATK_RELATION_LABELLED_BY);
/* check whether has a labelled_by relation already */
- if (relation != NULL)
+ if (relation != NULL) {
+ g_object_unref (set);
return;
+ }
}
+ g_clear_object (&set);
+
set = atk_object_ref_relation_set (a11y_timezone_entry);
if (!set)
return;
@@ -150,6 +154,8 @@ timezone_entry_add_relation (ETimezoneEntry *timezone_entry)
ATK_OBJECT (target_object));
}
}
+
+ g_clear_object (&set);
}
/* The arrow button beside the date field has been clicked, so we show the
diff --git a/src/e-util/e-dateedit.c b/src/e-util/e-dateedit.c
index 5aca100f7b..855d86406b 100644
--- a/src/e-util/e-dateedit.c
+++ b/src/e-util/e-dateedit.c
@@ -2089,10 +2089,14 @@ add_relation (EDateEdit *dedit,
relation = atk_relation_set_get_relation_by_type (
set, ATK_RELATION_LABELLED_BY);
/* check whether has a labelled_by relation already */
- if (relation != NULL)
+ if (relation != NULL) {
+ g_object_unref (set);
return;
+ }
}
+ g_clear_object (&set);
+
set = atk_object_ref_relation_set (a11yEdit);
if (!set)
return;
@@ -2109,6 +2113,8 @@ add_relation (EDateEdit *dedit,
ATK_OBJECT (target_object));
}
}
+
+ g_clear_object (&set);
}
/* This sets the text in the date entry according to the current settings. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]