summaryrefslogtreecommitdiffstats
path: root/lib/cache.c
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2012-11-15 23:20:18 (GMT)
committerThomas Graf <tgraf@suug.ch>2012-11-15 23:29:58 (GMT)
commitcb82c2a5451a52e7365957a2325258af1b179aee (patch)
tree2f166ab92205d745534500d525fb6e07ab3213c9 /lib/cache.c
parent2b3912a320ef74b31d84380d91ec036dbf1b9f52 (diff)
downloadlibnl-cb82c2a5451a52e7365957a2325258af1b179aee.zip
libnl-cb82c2a5451a52e7365957a2325258af1b179aee.tar.gz
libnl-cb82c2a5451a52e7365957a2325258af1b179aee.tar.bz2
use safe cache lookup variants internally
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Diffstat (limited to 'lib/cache.c')
-rw-r--r--lib/cache.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/cache.c b/lib/cache.c
index 257a41b..36566e0 100644
--- a/lib/cache.c
+++ b/lib/cache.c
@@ -266,11 +266,13 @@ int nl_cache_alloc_name(const char *kind, struct nl_cache **result)
struct nl_cache_ops *ops;
struct nl_cache *cache;
- ops = nl_cache_ops_lookup(kind);
+ ops = nl_cache_ops_lookup_safe(kind);
if (!ops)
return -NLE_NOCACHE;
- if (!(cache = nl_cache_alloc(ops)))
+ cache = nl_cache_alloc(ops);
+ nl_cache_ops_put(ops);
+ if (!cache)
return -NLE_NOMEM;
*result = cache;