g_free() to auto_gfree, introduce auto_guchar

Fix 11 potential mem leaks in theme.c
This commit is contained in:
John Hernandez
2023-07-13 17:04:59 +02:00
parent 3a4cd7da48
commit 8304ac86ff
39 changed files with 145 additions and 233 deletions

View File

@@ -65,7 +65,7 @@ static GHashTable* jid_to_ver;
static GHashTable* jid_to_caps;
static GHashTable* prof_features;
static char* my_sha1;
static gchar* my_sha1;
static void _save_cache(void);
static EntityCapabilities* _caps_by_ver(const char* const ver);
@@ -464,8 +464,7 @@ static void
_save_cache(void)
{
gsize g_data_size;
gchar* g_cache_data = g_key_file_to_data(cache, &g_data_size, NULL);
auto_gchar gchar* g_cache_data = g_key_file_to_data(cache, &g_data_size, NULL);
g_file_set_contents(cache_loc, g_cache_data, g_data_size, NULL);
g_chmod(cache_loc, S_IRUSR | S_IWUSR);
g_free(g_cache_data);
}