summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@igalia.com>2017-09-01 08:54:40 -0500
committerMichael Catanzaro <mcatanzaro@igalia.com>2017-09-03 11:31:13 -0500
commit1515d94ffe7b7b00dba4b2969a6897038c1499f6 (patch)
treee827c8e184d60f467c59b690b22c1f8b18260378
parent7aef778b3764fbd27cd230402a1b0d5df73ac0ae (diff)
downloadepiphany-1515d94ffe7b7b00dba4b2969a6897038c1499f6.tar.gz
permissions-manager: Fix leak in error path
-rw-r--r--lib/ephy-permissions-manager.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/ephy-permissions-manager.c b/lib/ephy-permissions-manager.c
index 454efc7de..101156a11 100644
--- a/lib/ephy-permissions-manager.c
+++ b/lib/ephy-permissions-manager.c
@@ -354,7 +354,7 @@ ephy_permissions_manager_get_matching_origins (EphyPermissionsManager *manager,
{
GKeyFile *file;
char *filename;
- char **groups;
+ char **groups = NULL;
gsize groups_length;
GList *origins = NULL;
GError *error = NULL;
@@ -380,7 +380,7 @@ ephy_permissions_manager_get_matching_origins (EphyPermissionsManager *manager,
if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
g_warning ("Error processing %s: %s", filename, error->message);
g_error_free (error);
- return NULL;
+ goto out;
}
groups = g_key_file_get_groups (file, &groups_length);
@@ -388,10 +388,6 @@ ephy_permissions_manager_get_matching_origins (EphyPermissionsManager *manager,
origins = g_list_concat (origins,
origins_for_keyfile_group (file, filename, groups[i], type, permit));
- g_key_file_unref (file);
- g_strfreev (groups);
- g_free (filename);
-
/* Cache the results. */
if (origins != NULL) {
g_hash_table_insert (permit ? manager->permission_type_permitted_origins
@@ -400,6 +396,11 @@ ephy_permissions_manager_get_matching_origins (EphyPermissionsManager *manager,
origins);
}
+out:
+ g_key_file_unref (file);
+ g_strfreev (groups);
+ g_free (filename);
+
return origins;
}