• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From 1a979ab4947fc259af01ea65263aaa4d417553fb Mon Sep 17 00:00:00 2001
2From: Philip Withnall <pwithnall@gnome.org>
3Date: Tue, 14 Nov 2023 11:00:21 +0000
4Subject: [PATCH] gutils: Fix an unlikely minor leak in g_build_user_data_dir()
5
6A leak can happen if the `data_dir` is the empty string.
7
8See https://gitlab.gnome.org/GNOME/glib/-/jobs/3294034
9
10Conflict:NA
11Reference:https://gitlab.gnome.org/GNOME/glib/-/commit/1a979ab4947fc259af01ea65263aaa4d417553fb
12
13Signed-off-by: Philip Withnall <pwithnall@gnome.org>
14---
15 glib/gutils.c | 1 +
16 1 file changed, 1 insertion(+)
17
18diff --git a/glib/gutils.c b/glib/gutils.c
19index dfe115843e..ffc7d750c7 100644
20--- a/glib/gutils.c
21+++ b/glib/gutils.c
22@@ -1883,6 +1883,7 @@ g_build_user_data_dir (void)
23   if (!data_dir || !data_dir[0])
24     {
25       gchar *home_dir = g_build_home_dir ();
26+      g_free (data_dir);
27       data_dir = g_build_filename (home_dir, ".local", "share", NULL);
28       g_free (home_dir);
29     }
30--
31GitLab