Skip to content

Refcount leak in generator function #999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bnoordhuis opened this issue Mar 27, 2025 · 1 comment
Closed

Refcount leak in generator function #999

bnoordhuis opened this issue Mar 27, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@bnoordhuis
Copy link
Contributor

bnoordhuis commented Mar 27, 2025

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.

@bnoordhuis bnoordhuis added the bug Something isn't working label Mar 27, 2025
@saghul
Copy link
Contributor

saghul commented Mar 31, 2025

bellard/quickjs@0d7aaed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants