Hold reference to obj while calling callback of cache iterator
This commit is contained in:
parent
33e94038c4
commit
552c85cab7
1 changed files with 5 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue