Changeset f89204ee in mainline for uspace/srv/devman/devtree.c


Ignore:
Timestamp:
2018-11-27T16:48:25Z (5 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3083c74
Parents:
1b555f0f
git-author:
Jakub Jermar <jakub@…> (2018-11-22 16:55:28)
git-committer:
Jakub Jermar <jakub@…> (2018-11-27 16:48:25)
Message:

Fix devman function reference counting

After commit 498ced18a4, create_fun_node() returns a fun pointer with an
implicit reference. Adding an extra reference for creation thus adds a
reference that will never be dropped and the function object will be
leaked.

This commit fixes the reference counting issue and also adds the missing
check to the call to insert_fun_node().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/devman/devtree.c

    r1b555f0f rf89204ee  
    144144        }
    145145
    146         fun_add_ref(fun);
    147         insert_fun_node(tree, fun, str_dup(""), NULL);
     146        if (!insert_fun_node(tree, fun, str_dup(""), NULL)) {
     147                fun_del_ref(fun);       /* fun is destroyed */
     148                fibril_rwlock_write_unlock(&tree->rwlock);
     149                return false;
     150        }
    148151
    149152        match_id_t *id = create_match_id();
Note: See TracChangeset for help on using the changeset viewer.