Commit 1515d94f authored by Michael Catanzaro's avatar Michael Catanzaro

permissions-manager: Fix leak in error path

parent 7aef778b
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment