Skip to content

Commit

Permalink
Fix ASan report about alloc/dealloc mismatch when compiled with C++23 (
Browse files Browse the repository at this point in the history
…#633)

Co-authored-by: Alexey Milovidov <[email protected]>
  • Loading branch information
waahm7 and alexey-milovidov authored Jun 25, 2024
1 parent 55f2a48 commit 2be4b09
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crt/aws-lc
4 changes: 4 additions & 0 deletions include/aws/crt/StlAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ namespace Aws
return static_cast<RawPointer>(aws_mem_acquire(m_allocator, n * sizeof(T)));
}

#if _LIBCPP_STD_VER > 20
std::allocation_result<T *> allocate_at_least(size_type n) { return {allocate(n), n}; }
#endif

void deallocate(RawPointer p, size_type)
{
AWS_ASSERT(m_allocator);
Expand Down
1 change: 1 addition & 0 deletions source/io/HostResolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ namespace Aws

size_t len = hostAddresses ? aws_array_list_length(hostAddresses) : 0;
Vector<HostAddress> addresses;
addresses.reserve(len);

for (size_t i = 0; i < len; ++i)
{
Expand Down

0 comments on commit 2be4b09

Please sign in to comment.