Skip to content

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

Description

@CookStar

Code:

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

Output:

free(): double free detected in tcache 2

This also applies to CustomType.

Code:

frommemoryimportallocfrommemoryimportmake_objectfrommemory.managerimportCustomTypefrommemory.managerimportTypeManagermanager=TypeManager()
classTest(CustomType, metaclass=manager):
_size=4deftest_customtype():
ptr=alloc(4)
make_object(Test, ptr)
test_customtype()

Output:

free(): double free detected in tcache 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions