From 5ecf1f5ac617f5d837de1574d4e8ca17976119d7 Mon Sep 17 00:00:00 2001 From: Jin Hai Date: Fri, 13 Dec 2024 21:25:30 +0800 Subject: [PATCH] Fix memory release bugs (#2370) ### What problem does this PR solve? _Briefly describe what this PR aims to solve. Include background context that will help reviewers understand the purpose of the PR._ ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) Signed-off-by: jinhai --- src/main/infinity.cpp | 20 ++++++++++---------- src/scheduler/fragment_context.cpp | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/infinity.cpp b/src/main/infinity.cpp index b45f49ed28..db35e92e09 100644 --- a/src/main/infinity.cpp +++ b/src/main/infinity.cpp @@ -1055,7 +1055,7 @@ QueryResult Infinity::Explain(const String &db_name, } }); DeferFn free_highlight_columns([&]() { - if (output_columns != nullptr) { + if (highlight_columns != nullptr) { for (auto &highlight_column : *highlight_columns) { delete highlight_column; highlight_column = nullptr; @@ -1065,7 +1065,7 @@ QueryResult Infinity::Explain(const String &db_name, } }); DeferFn free_order_by_list([&]() { - if (output_columns != nullptr) { + if (order_by_list != nullptr) { for (auto &order_by : *order_by_list) { delete order_by; order_by = nullptr; @@ -1075,7 +1075,7 @@ QueryResult Infinity::Explain(const String &db_name, } }); DeferFn free_group_by_list([&]() { - if (output_columns != nullptr) { + if (group_by_list != nullptr) { for (auto &group_by : *group_by_list) { delete group_by; group_by = nullptr; @@ -1087,8 +1087,8 @@ QueryResult Infinity::Explain(const String &db_name, UniquePtr query_context_ptr; GET_QUERY_CONTEXT(GetQueryContext(), query_context_ptr); - UniquePtr explain_statment = MakeUnique(); - explain_statment->type_ = explain_type; + UniquePtr explain_statement = MakeUnique(); + explain_statement->type_ = explain_type; SelectStatement *select_statement = new SelectStatement(); @@ -1112,9 +1112,9 @@ QueryResult Infinity::Explain(const String &db_name, select_statement->order_by_list_ = order_by_list; select_statement->group_by_list_ = group_by_list; - explain_statment->statement_ = select_statement; + explain_statement->statement_ = select_statement; - QueryResult result = query_context_ptr->QueryStatement(explain_statment.get()); + QueryResult result = query_context_ptr->QueryStatement(explain_statement.get()); output_columns = nullptr; highlight_columns = nullptr; order_by_list = nullptr; @@ -1153,7 +1153,7 @@ QueryResult Infinity::Search(const String &db_name, } }); DeferFn free_highlight_columns([&]() { - if (output_columns != nullptr) { + if (highlight_columns != nullptr) { for (auto &highlight_column : *highlight_columns) { delete highlight_column; highlight_column = nullptr; @@ -1163,7 +1163,7 @@ QueryResult Infinity::Search(const String &db_name, } }); DeferFn free_order_by_list([&]() { - if (output_columns != nullptr) { + if (order_by_list != nullptr) { for (auto &order_by : *order_by_list) { delete order_by; order_by = nullptr; @@ -1173,7 +1173,7 @@ QueryResult Infinity::Search(const String &db_name, } }); DeferFn free_group_by_list([&]() { - if (output_columns != nullptr) { + if (group_by_list != nullptr) { for (auto &group_by : *group_by_list) { delete group_by; group_by = nullptr; diff --git a/src/scheduler/fragment_context.cpp b/src/scheduler/fragment_context.cpp index 303644b89d..f3821de253 100644 --- a/src/scheduler/fragment_context.cpp +++ b/src/scheduler/fragment_context.cpp @@ -566,7 +566,7 @@ void FragmentContext::BuildTask(QueryContext *query_context, FragmentContext *pa for (SizeT task_id = 0; task_id < tasks.size(); ++task_id) { FragmentTask *task = tasks[task_id].get(); - // build the input and output state of each opeartor + // build the input and output state of each operator UniquePtr operator_state = MakeTaskState(operator_id, fragment_operators, task, fragment_context.get()); // Connect the input, output state. Connect fragment to its parent if needed