diff --git a/ydb/library/yql/minikql/mkql_alloc.cpp b/ydb/library/yql/minikql/mkql_alloc.cpp index 2ee6034cb965..fc2ae88240f8 100644 --- a/ydb/library/yql/minikql/mkql_alloc.cpp +++ b/ydb/library/yql/minikql/mkql_alloc.cpp @@ -37,7 +37,8 @@ void TAllocState::CleanupPAllocList(TListEntry* root) { for (auto curr = root->Right; curr != root; ) { auto next = curr->Right; auto size = ((TMkqlPAllocHeader*)curr)->Size; - MKQLFreeWithSize(curr, size, EMemorySubPool::Default); // may free items from OffloadedBlocksRoot + auto fullSize = size + sizeof(TMkqlPAllocHeader); + MKQLFreeWithSize(curr, fullSize, EMemorySubPool::Default); // may free items from OffloadedBlocksRoot curr = next; } diff --git a/ydb/library/yql/parser/pg_wrapper/comp_factory.cpp b/ydb/library/yql/parser/pg_wrapper/comp_factory.cpp index 4dd8d5e7e415..930a9ed9e76a 100644 --- a/ydb/library/yql/parser/pg_wrapper/comp_factory.cpp +++ b/ydb/library/yql/parser/pg_wrapper/comp_factory.cpp @@ -127,7 +127,8 @@ void MkqlAllocSetFree(MemoryContext context, void* pointer) { auto header = ((TMkqlPAllocHeader*)pointer) - 1; // remove this block from list header->U.Entry.Unlink(); - MKQLFreeWithSize(header, header->Size, EMemorySubPool::Default); + auto fullSize = header->Size + sizeof(TMkqlPAllocHeader); + MKQLFreeWithSize(header, fullSize, EMemorySubPool::Default); } }