Skip to content
Snippets Groups Projects
Commit 3ed1f9ab authored by Thomas Graf's avatar Thomas Graf
Browse files

cache: Hold cache reference while a cache is being provided


Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
parent c658a6ee
Branches
No related merge requests found
......@@ -217,8 +217,10 @@ void nl_cache_mngt_provide(struct nl_cache *cache)
ops = cache_ops_lookup_for_obj(cache->c_ops->co_obj_ops);
if (!ops)
BUG();
else
else {
nl_cache_get(cache);
ops->co_major_cache = cache;
}
}
/**
......@@ -236,8 +238,10 @@ void nl_cache_mngt_unprovide(struct nl_cache *cache)
ops = cache_ops_lookup_for_obj(cache->c_ops->co_obj_ops);
if (!ops)
BUG();
else if (ops->co_major_cache == cache)
else if (ops->co_major_cache == cache) {
nl_cache_free(ops->co_major_cache);
ops->co_major_cache = NULL;
}
}
struct nl_cache *__nl_cache_mngt_require(const char *name)
......
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