Skip to content
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

Wrapping a Pointer where auto_dealloc is True with another Pointer will cause double free. #492

Open
CookStar opened this issue Aug 23, 2023 · 0 comments

Comments

@CookStar
Copy link
Contributor

Code:

from memory import Pointer
from memory import alloc

def test_pointer():
    ptr = alloc(4)
    Pointer(ptr)

test_pointer()

Output:

free(): double free detected in tcache 2

This also applies to CustomType.

Code:

from memory import alloc
from memory import make_object
from memory.manager import CustomType
from memory.manager import TypeManager

manager = TypeManager()

class Test(CustomType, metaclass=manager):
    _size = 4

def test_customtype():
    ptr = alloc(4)
    make_object(Test, ptr)

test_customtype()

Output:

free(): double free detected in tcache 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant