summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2011-03-17 16:30:32 (GMT)
committerThomas Graf <tgraf@suug.ch>2011-03-17 16:30:32 (GMT)
commit552c85cab787fde0aeb68b50eb56690e7652710c (patch)
treebaec5561a8a06a4e685b330a1a0bdf10e51b4dc1 /lib
parent33e94038c45aec39024c7e47441c6b25b7a11a9b (diff)
downloadlibnl-552c85cab787fde0aeb68b50eb56690e7652710c.zip
libnl-552c85cab787fde0aeb68b50eb56690e7652710c.tar.gz
libnl-552c85cab787fde0aeb68b50eb56690e7652710c.tar.bz2
Hold reference to obj while calling callback of cache iterator
Diffstat (limited to 'lib')
-rw-r--r--lib/cache.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/cache.c b/lib/cache.c
index e0e845d..601dadc 100644
--- a/lib/cache.c
+++ b/lib/cache.c
@@ -834,7 +834,12 @@ void nl_cache_foreach_filter(struct nl_cache *cache, struct nl_object *filter,
continue;
}
+ /* Caller may hold obj for a long time */
+ nl_object_get(obj);
+
cb(obj, arg);
+
+ nl_object_put(obj);
}
}