Opened 5 years ago
Last modified 5 years ago
#772 closed defect
Review commit 498ced18a4 for reference leaks — at Version 1
Reported by: | Jakub Jermář | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 0.8.0 |
Component: | helenos/unspecified | Version: | mainline |
Keywords: | Cc: | ||
Blocker for: | Depends on: | ||
See also: | #744 |
Description (last modified by )
Commit 498ced18a4 introduced a new reference counting API into uspace. The semantics of the API might differ from the semantics of the code it replaced and so there is a possibility of reference leaks analogous to #744.
For example, changes to devman look fishy and analogous to #744:
--- a/uspace/srv/devman/fun.c +++ b/uspace/srv/devman/fun.c @@ -59,7 +59,7 @@ fun_node_t *create_fun_node(void) return NULL; fun->state = FUN_INIT; - atomic_set(&fun->refcnt, 0); + refcount_init(&fun->refcnt); fibril_mutex_initialize(&fun->busy_lock); link_initialize(&fun->dev_functions); list_initialize(&fun->match_ids.ids);
So the caller of create_fun_node() already has a reference created by refcount_init(). But then at the two locations that call create_fun_node(), we see the reference count bumped. In devman_add_function, there is:
fun_node_t *fun = create_fun_node(); /* One reference for creation, one for us */ fun_add_ref(fun); fun_add_ref(fun);
This does not look right wrt. the new semantics.
Change History (1)
comment:1 by , 5 years ago
Description: | modified (diff) |
---|---|
Summary: | Review commit 498ced18a4 for memory leaks → Review commit 498ced18a4 for reference leaks |
Note:
See TracTickets
for help on using tickets.