diff --git a/src/sql/engine/sort/ob_sort_op_impl.cpp b/src/sql/engine/sort/ob_sort_op_impl.cpp index 8c2e421d3b4ce497e562f1cccf71ae13e789c452..c27625697609778eef85ea949b051140a7509ad1 100644 --- a/src/sql/engine/sort/ob_sort_op_impl.cpp +++ b/src/sql/engine/sort/ob_sort_op_impl.cpp @@ -617,8 +617,8 @@ int ObSortOpImpl::init( default_block_size))) { LOG_WARN("init row store failed", K(ret)); } else if (batch_size > 0 - && NULL == (stored_rows_ = static_cast( - mem_context_->get_arena_allocator().alloc( + && OB_ISNULL(stored_rows_ = static_cast( + mem_context_->get_malloc_allocator().alloc( sizeof(*stored_rows_) * batch_size)))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("allocate memory failed", K(ret)); @@ -699,6 +699,10 @@ void ObSortOpImpl::reset() mem_context_->get_malloc_allocator().free(ems_heap_); ems_heap_ = NULL; } + if (NULL != stored_rows_) { + mem_context_->get_malloc_allocator().free(stored_rows_); + stored_rows_ = NULL; + } if (NULL != buckets_) { mem_context_->get_malloc_allocator().free(buckets_); buckets_ = NULL;