Skip to content

Refcount leak in generator function #999

Closed
@bnoordhuis

Description

@bnoordhuis

Refs: bellard/quickjs#394

function* f(r){ return r } // must return r
[...f({})]

r's ref count in async_func_free is 2, not 1.

f's bytecode looks like this:

;; function* f(r){ return r }      
                                                                               
        initial_yield                                                          
        get_arg0        0    ; r
        return_async       

The async stack frame at time of free looks like this: [r, undefined] (where slot 0 is arg 0); I suspect it should be [r, r] because then the ref counts would match up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions