[glib/wip/baedert/xdgmime-leak] xdgmime: Free xdg_dirs in shutdown()
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/baedert/xdgmime-leak] xdgmime: Free xdg_dirs in shutdown()
- Date: Sun, 21 Jul 2019 10:02:37 +0000 (UTC)
commit 42c8f599b9955efc83d76ceae60d9174a9aac97f
Author: Timm Bäder <mail baedert org>
Date: Sun Jul 21 11:56:07 2019 +0200
xdgmime: Free xdg_dirs in shutdown()
gio/xdgmime/xdgmime.c | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/gio/xdgmime/xdgmime.c b/gio/xdgmime/xdgmime.c
index fa45d7a0c..05b129c87 100644
--- a/gio/xdgmime/xdgmime.c
+++ b/gio/xdgmime/xdgmime.c
@@ -118,7 +118,22 @@ xdg_dir_time_list_add (char *file_name,
list->next = dir_time_list;
dir_time_list = list;
}
-
+
+static void
+xdg_dirs_free (void)
+{
+ if (xdg_dirs)
+ {
+ size_t i;
+
+ for (i = 0; xdg_dirs[i] != NULL; i ++)
+ free (xdg_dirs[i]);
+
+ free (xdg_dirs);
+ xdg_dirs = NULL;
+ }
+}
+
static void
xdg_dir_time_list_free (XdgDirTimeList *list)
{
@@ -339,11 +354,7 @@ xdg_mime_set_dirs (const char * const *dirs)
{
size_t i;
- for (i = 0; xdg_dirs != NULL && xdg_dirs[i] != NULL; i++)
- free (xdg_dirs[i]);
- if (xdg_dirs != NULL)
- free (xdg_dirs[i]);
- xdg_dirs = NULL;
+ xdg_dirs_free ();
if (dirs != NULL)
{
@@ -742,6 +753,8 @@ xdg_mime_shutdown (void)
for (list = callback_list; list; list = list->next)
(list->callback) (list->data);
+ xdg_dirs_free ();
+
need_reread = TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]