Skip to content

possible invalid usage of realloc #74

@Dushistov

Description

@Dushistov

Here:

https://github.com/couchbaselabs/fleece/blob/60bfb99bfed50329a2a8c3a3fb0cacea074ea799/Fleece/Tree/MutableNode.hh#L332

operator new/delete defined as:

 static void* operator new(size_t size, unsigned capacity) {
            return ::operator new(size + capacity*sizeof(NodeRef));
        }

but then

 MutableInterior* grow() {
            assert_precondition(capacity() < kMaxChildren);
            auto replacement = (MutableInterior*)realloc(this,

should be malloc/free used instead of ::operator new in the first place,
to make it possible to use realloc here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions