Skip to content

Mismatched free() / delete / delete [] when using EAWebKit #550

@TornadoCookie

Description

@TornadoCookie

Allocating a string uses the EAWebKit allocator, but deallocating it uses the system allocator. This seems to mess up the stack.
Version: EASTL 3.16.05 (EAWebKit 16.4.2.0.0)

Section of valgrind log:
==689759== Mismatched free() / delete / delete []
==689759== at 0x484BFA4: operator delete (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==689759== by 0x6A86EEF: deallocate (allocator.h:292)
==689759== by 0x6A86EEF: DoFree (string.h:3281)
==689759== by 0x6A86EEF: eastl::basic_string<char, eastl::allocator>::DeallocateSelf() (string.h:3349)
==689759== by 0x6DA2030: ~basic_string (string.h:995)
==689759== by 0x6DA2030: EA::WebKit::DebugLogCallback(eastl::basic_string<char, eastl::allocator> const&, bool) (EAWebKit.cpp:632)
==689759== by 0x6DA3D29: EA::WebKit::DebugLogCallbackInternal(bool, char const*, __va_list_tag*) (EAWebKit.cpp:638)
==689759== by 0x74C14DB: vprintf_stderr_common (Assertions.cpp:152)
==689759== by 0x74C1834: printf_stderr_common (Assertions.cpp:235)
==689759== by 0x74C18D4: WTFReportAssertionFailure (Assertions.cpp:267)
==689759== by 0x6DA4C52: EA::WebKit::GetAllocator() (EAWebKitAllocator.cpp:353)
==689759== by 0x6DA1A6B: EA::WebKit::Init(EA::WebKit::AppCallbacks*, EA::WebKit::AppSystems*) (EAWebKit.cpp:676)
==689759== by 0x6DA1C1E: EA::WebKit::EAWebKitLib::Init(EA::WebKit::AppCallbacks*, EA::WebKit::AppSystems*) (EAWebKit.cpp:196)
==689759== by 0x10A49F: main (main.cpp:98)
==689759== Address 0x9598910 is 0 bytes inside a block of size 52 alloc'd
==689759== at 0x4846828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==689759== by 0x6DA557D: EA::WebKit::DefaultAllocator::Malloc(unsigned long, int, char const*) (EAWebKitAllocator.cpp:98)
==689759== by 0x6DB40EA: operator new[](unsigned long, char const*, int, unsigned int, char const*, int) (EAWebKitNewDelete.cpp:173)
==689759== by 0x63F4F81: eastl::allocator::allocate(unsigned long, int) (allocator.h:245)
==689759== by 0x6DA431B: DoAllocate (string.h:3273)
==689759== by 0x6DA431B: eastl::basic_string<char, eastl::allocator>::append(char const*, char const*) (string.h:1720)
==689759== by 0x6DA440F: eastl::basic_string<char, eastl::allocator>::append(eastl::basic_string<char, eastl::allocator> const&) (string.h:1612)
==689759== by 0x6DA1F8A: operator+= (string.h:1590)
==689759== by 0x6DA1F8A: EA::WebKit::DebugLogCallback(eastl::basic_string<char, eastl::allocator> const&, bool) (EAWebKit.cpp:608)
==689759== by 0x6DA3D29: EA::WebKit::DebugLogCallbackInternal(bool, char const*, __va_list_tag*) (EAWebKit.cpp:638)
==689759== by 0x74C14DB: vprintf_stderr_common (Assertions.cpp:152)
==689759== by 0x74C1834: printf_stderr_common (Assertions.cpp:235)
==689759== by 0x74C18D4: WTFReportAssertionFailure (Assertions.cpp:267)
==689759== by 0x6DA4C52: EA::WebKit::GetAllocator() (EAWebKitAllocator.cpp:353)

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