Skip to content

Commit

Permalink
Fix memory release bugs
Browse files Browse the repository at this point in the history
Signed-off-by: jinhai <[email protected]>
  • Loading branch information
JinHai-CN committed Dec 13, 2024
1 parent ba8dc1c commit 9aa046f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions src/main/infinity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -1087,8 +1087,8 @@ QueryResult Infinity::Explain(const String &db_name,

UniquePtr<QueryContext> query_context_ptr;
GET_QUERY_CONTEXT(GetQueryContext(), query_context_ptr);
UniquePtr<ExplainStatement> explain_statment = MakeUnique<ExplainStatement>();
explain_statment->type_ = explain_type;
UniquePtr<ExplainStatement> explain_statement = MakeUnique<ExplainStatement>();
explain_statement->type_ = explain_type;

SelectStatement *select_statement = new SelectStatement();

Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/scheduler/fragment_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<OperatorState> operator_state = MakeTaskState(operator_id, fragment_operators, task, fragment_context.get());

// Connect the input, output state. Connect fragment to its parent if needed
Expand Down

0 comments on commit 9aa046f

Please sign in to comment.