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

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
Philip Withnall 2023-11-14 11:00:21 +00:00
parent aed9098530
commit 1a979ab494

View File

@ -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);
}