﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	field_blocks	field_dependson	field_seealso
772	Review commit 498ced18a4 for reference leaks	Jakub Jermář	Jakub Jermář	"Commit [https://github.com/HelenOS/helenos/commit/498ced18a4f90fe1c9eee028e354d61b39de484d 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."	defect	closed	major	0.8.0	helenos/unspecified	mainline	fixed					#744
