summaryrefslogtreecommitdiff
path: root/lib/route/neightbl.c
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2012-11-16 01:11:55 +0100
committerThomas Graf <tgraf@suug.ch>2012-11-16 01:11:55 +0100
commit00132b46968fff7975eb8d20a307c626dfefe2f1 (patch)
treee2d6ea3d7535358435ea136019e03c35c22c19ba /lib/route/neightbl.c
parent23c4ef67c735813fd41f66f6722b996d1ad7314a (diff)
downloadlibnl-00132b46968fff7975eb8d20a307c626dfefe2f1.tar.gz
cache: provide safe variant of nl_cache_mngt_require() and use it
This makes runtime removal of cache operations possible if non-safe API is not in use by application. The non-safe API will be removed in the next major version. Signed-off-by: Thomas Graf <tgraf@suug.ch>
Diffstat (limited to 'lib/route/neightbl.c')
-rw-r--r--lib/route/neightbl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/route/neightbl.c b/lib/route/neightbl.c
index 1efa5cb..509617b 100644
--- a/lib/route/neightbl.c
+++ b/lib/route/neightbl.c
@@ -237,7 +237,7 @@ static void neightbl_dump_line(struct nl_object *arg, struct nl_dump_params *p)
if (ntbl->nt_parms.ntp_mask & NEIGHTBLPARM_ATTR_IFINDEX) {
struct nl_cache *link_cache;
- link_cache = nl_cache_mngt_require("route/link");
+ link_cache = nl_cache_mngt_require_safe("route/link");
if (link_cache) {
char buf[32];
@@ -245,6 +245,7 @@ static void neightbl_dump_line(struct nl_object *arg, struct nl_dump_params *p)
rtnl_link_i2name(link_cache,
ntbl->nt_parms.ntp_ifindex,
buf, sizeof(buf)));
+ nl_cache_put(link_cache);
} else
nl_dump(p, "<%u> ", ntbl->nt_parms.ntp_ifindex);
} else