mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Close some more memory leaks
This commit is contained in:
parent
40c543ef21
commit
97b7c26570
@ -147,7 +147,7 @@ gnc_state_set_base (const QofSession *session)
|
||||
{
|
||||
DEBUG ("Trying old state file names for compatibility");
|
||||
i = 1;
|
||||
g_free ( sf_extension);
|
||||
g_free (sf_extension);
|
||||
sf_extension = g_strdup ("");
|
||||
|
||||
/* Regardless of whether or not an old state file is found,
|
||||
@ -190,6 +190,7 @@ gnc_state_set_base (const QofSession *session)
|
||||
}
|
||||
|
||||
DEBUG("Clean up");
|
||||
g_free(sf_extension);
|
||||
g_free(original);
|
||||
g_key_file_free (key_file);
|
||||
|
||||
|
@ -457,8 +457,8 @@ gnc_dotgnucash_dir (void)
|
||||
if (!gnc_validate_directory(tmp_dir, TRUE, &errmsg))
|
||||
exit(1);
|
||||
g_free(tmp_dir);
|
||||
tmp_dir = g_build_filename(tmp_dir, "translog", (gchar *)NULL);
|
||||
if (!gnc_validate_directory(dotgnucash, TRUE, &errmsg))
|
||||
tmp_dir = g_build_filename(dotgnucash, "translog", (gchar *)NULL);
|
||||
if (!gnc_validate_directory(tmp_dir, TRUE, &errmsg))
|
||||
exit(1);
|
||||
g_free(tmp_dir);
|
||||
|
||||
|
@ -325,6 +325,7 @@ gnc_menu_additions_assign_accel (ExtensionInfo *info, GHashTable *table)
|
||||
const gchar *ptr;
|
||||
gunichar uni;
|
||||
gint len;
|
||||
gboolean map_allocated = FALSE;
|
||||
|
||||
ENTER("Checking %s/%s [%s]", info->path, info->ae.label, info->ae.name);
|
||||
if (info->accel_assigned)
|
||||
@ -336,7 +337,10 @@ gnc_menu_additions_assign_accel (ExtensionInfo *info, GHashTable *table)
|
||||
/* Get map of used keys */
|
||||
map = g_hash_table_lookup(table, info->path);
|
||||
if (map == NULL)
|
||||
{
|
||||
map = g_strdup("");
|
||||
map_allocated = TRUE;
|
||||
}
|
||||
DEBUG("map '%s', path %s", map, info->path);
|
||||
|
||||
for (ptr = info->ae.label; *ptr; ptr = g_utf8_next_char(ptr))
|
||||
@ -356,6 +360,10 @@ gnc_menu_additions_assign_accel (ExtensionInfo *info, GHashTable *table)
|
||||
{
|
||||
/* Ran out of characters. Nothing to do. */
|
||||
info->accel_assigned = TRUE;
|
||||
if (map_allocated)
|
||||
{
|
||||
g_free(map);
|
||||
}
|
||||
LEAVE("All characters already assigned");
|
||||
return;
|
||||
}
|
||||
@ -375,6 +383,10 @@ gnc_menu_additions_assign_accel (ExtensionInfo *info, GHashTable *table)
|
||||
g_hash_table_replace(table, info->path, new_map);
|
||||
|
||||
info->accel_assigned = TRUE;
|
||||
if (map_allocated)
|
||||
{
|
||||
g_free(map);
|
||||
}
|
||||
LEAVE("assigned");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user