Changeset 9df0f64 in mainline for uspace/lib/drv/generic/driver.c


Ignore:
Timestamp:
2018-11-27T16:50:40Z (5 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e199ab3
Parents:
b10e9367
git-author:
Jakub Jermar <jakub@…> (2018-11-22 20:05:37)
git-committer:
Jakub Jermar <jakub@…> (2018-11-27 16:50:40)
Message:

Fix function reference counting

After commit 498ced1, a function is created with an implicit reference.
Adding an extra reference for creation thus adds a reference that will
never be dropped and the function will be leaked.

This commit removes the extra reference.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/driver.c

    rb10e9367 r9df0f64  
    731731                return NULL;
    732732
    733         /* Add one reference that will be dropped by ddf_fun_destroy() */
    734733        fun->dev = dev;
    735         fun_add_ref(fun);
     734        dev_add_ref(fun->dev);
    736735
    737736        fun->bound = false;
     
    741740                fun->name = str_dup(name);
    742741                if (fun->name == NULL) {
    743                         delete_function(fun);
     742                        fun_del_ref(fun);       /* fun is destroyed */
    744743                        return NULL;
    745744                }
Note: See TracChangeset for help on using the changeset viewer.