From 1a979ab4947fc259af01ea65263aaa4d417553fb Mon Sep 17 00:00:00 2001
From: Philip Withnall <pwithnall@gnome.org>
Date: Tue, 14 Nov 2023 11:00:21 +0000
Subject: [PATCH] gutils: Fix an unlikely minor leak in g_build_user_data_dir()
 
A leak can happen if the `data_dir` is the empty string.
 
See https://gitlab.gnome.org/GNOME/glib/-/jobs/3294034
 
Conflict:NA
Reference:https://gitlab.gnome.org/GNOME/glib/-/commit/1a979ab4947fc259af01ea65263aaa4d417553fb
 
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
---
 glib/gutils.c | 1 +
 1 file changed, 1 insertion(+)
 
diff --git a/glib/gutils.c b/glib/gutils.c
index dfe115843e..ffc7d750c7 100644
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -1883,6 +1883,7 @@ g_build_user_data_dir (void)
   if (!data_dir || !data_dir[0])
     {
       gchar *home_dir = g_build_home_dir ();
+      g_free (data_dir);
       data_dir = g_build_filename (home_dir, ".local", "share", NULL);
       g_free (home_dir);
     }
-- 
GitLab