Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

policy: factor out logic to free an item

  • Loading branch information...
commit 9482cfca19f22132e8b4ac7379ac6369300610dc 1 parent d6a34f0
Daniel Mack zonque authored
Showing with 14 additions and 9 deletions.
  1. +14 −9 policy.c
23 policy.c
View
@@ -83,6 +83,19 @@ struct kdbus_policy_db_entry {
struct list_head access_list;
};
+static void kdbus_policy_db_entry_free(struct kdbus_policy_db_entry *e)
+{
+ struct kdbus_policy_db_entry_access *a, *tmp;
+
+ list_for_each_entry_safe(a, tmp, &e->access_list, list) {
+ list_del(&a->list);
+ kfree(a);
+ }
+
+ kfree(e->name);
+ kfree(e);
+}
+
/**
* kdbus_policy_db_free - drop a policy database reference
* @db: The policy database
@@ -97,16 +110,8 @@ void kdbus_policy_db_free(struct kdbus_policy_db *db)
/* purge entries */
mutex_lock(&db->entries_lock);
hash_for_each_safe(db->entries_hash, i, tmp, e, hentry) {
- struct kdbus_policy_db_entry_access *a, *tmp;
-
- list_for_each_entry_safe(a, tmp, &e->access_list, list) {
- list_del(&a->list);
- kfree(a);
- }
-
hash_del(&e->hentry);
- kfree(e->name);
- kfree(e);
+ kdbus_policy_db_entry_free(e);
}
mutex_unlock(&db->entries_lock);
Please sign in to comment.
Something went wrong with that request. Please try again.