From 42e535f7f5caef0836969b05f07fca0713c3f0d0 Mon Sep 17 00:00:00 2001 From: obdev Date: Wed, 20 Nov 2024 17:16:18 +0000 Subject: [PATCH] fix topn runtime filter memory leak problem --- src/sql/engine/sort/ob_pd_topn_sort_filter.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/sql/engine/sort/ob_pd_topn_sort_filter.cpp b/src/sql/engine/sort/ob_pd_topn_sort_filter.cpp index 27f1dedf6..6cbb044aa 100644 --- a/src/sql/engine/sort/ob_pd_topn_sort_filter.cpp +++ b/src/sql/engine/sort/ob_pd_topn_sort_filter.cpp @@ -106,6 +106,16 @@ int ObPushDownTopNFilter::init(bool is_fetch_with_ties, enabled_ = true; } + if (OB_FAIL(ret)) { + if (pd_topn_filter_msg != nullptr) { + (void)pd_topn_filter_msg->destroy(); + mem_context_->get_malloc_allocator().free(pd_topn_filter_msg); + pd_topn_filter_msg = nullptr; + pd_topn_filter_msg_ = nullptr; + enabled_ = false; + } + } + LOG_TRACE("[TopN Filter] init topn filter msg"); return ret; }