Changeset 3612e9f in mainline


Ignore:
Timestamp:
2018-11-22T20:05:37Z (5 years ago)
Author:
Jakub Jermar <jakub@…>
Parents:
ca21f1e2
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

    rca21f1e2 r3612e9f  
    733733                return NULL;
    734734
    735         /* Add one reference that will be dropped by ddf_fun_destroy() */
    736735        fun->dev = dev;
    737         fun_add_ref(fun);
     736        dev_add_ref(fun->dev);
    738737
    739738        fun->bound = false;
     
    743742                fun->name = str_dup(name);
    744743                if (fun->name == NULL) {
    745                         delete_function(fun);
     744                        fun_del_ref(fun);       /* fun is destroyed */
    746745                        return NULL;
    747746                }
Note: See TracChangeset for help on using the changeset viewer.