mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-24 21:16:15 +01:00
gutils: Fix unlikely minor leaks in xdg directory functions
We leak if we have a non-null empty string. This was already fixed for
g_build_user_data_dir() in 1a979ab494
so now fix the others as well.
This commit is contained in:
parent
f64d4aad6e
commit
1196ac7af6
@ -1940,6 +1940,7 @@ g_build_user_config_dir (void)
|
|||||||
if (!config_dir || !config_dir[0])
|
if (!config_dir || !config_dir[0])
|
||||||
{
|
{
|
||||||
gchar *home_dir = g_build_home_dir ();
|
gchar *home_dir = g_build_home_dir ();
|
||||||
|
g_free (config_dir);
|
||||||
config_dir = g_build_filename (home_dir, ".config", NULL);
|
config_dir = g_build_filename (home_dir, ".config", NULL);
|
||||||
g_free (home_dir);
|
g_free (home_dir);
|
||||||
}
|
}
|
||||||
@ -2003,6 +2004,7 @@ g_build_user_cache_dir (void)
|
|||||||
if (!cache_dir || !cache_dir[0])
|
if (!cache_dir || !cache_dir[0])
|
||||||
{
|
{
|
||||||
gchar *home_dir = g_build_home_dir ();
|
gchar *home_dir = g_build_home_dir ();
|
||||||
|
g_free (cache_dir);
|
||||||
cache_dir = g_build_filename (home_dir, ".cache", NULL);
|
cache_dir = g_build_filename (home_dir, ".cache", NULL);
|
||||||
g_free (home_dir);
|
g_free (home_dir);
|
||||||
}
|
}
|
||||||
@ -2065,6 +2067,7 @@ g_build_user_state_dir (void)
|
|||||||
if (!state_dir || !state_dir[0])
|
if (!state_dir || !state_dir[0])
|
||||||
{
|
{
|
||||||
gchar *home_dir = g_build_home_dir ();
|
gchar *home_dir = g_build_home_dir ();
|
||||||
|
g_free (state_dir);
|
||||||
state_dir = g_build_filename (home_dir, ".local/state", NULL);
|
state_dir = g_build_filename (home_dir, ".local/state", NULL);
|
||||||
g_free (home_dir);
|
g_free (home_dir);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user