fix core dump on vcase_expr::close (#9875)

This commit is contained in:
Pxl
2022-05-31 15:45:39 +08:00
committed by GitHub
parent 0cba6b7d95
commit fa50b63cee
4 changed files with 21 additions and 15 deletions

View File

@ -68,19 +68,15 @@ Status VCaseExpr::open(RuntimeState* state, VExprContext* context,
FunctionContext::FunctionStateScope scope) {
RETURN_IF_ERROR(VExpr::open(state, context, scope));
RETURN_IF_ERROR(VExpr::init_function_context(context, scope, _function));
CaseState* case_state = new CaseState {_data_type};
context->fn_context(_fn_context_index)
->set_function_state(FunctionContext::FRAGMENT_LOCAL, case_state);
context->fn_context(_fn_context_index)->set_function_state(scope, case_state);
return Status::OK();
}
void VCaseExpr::close(RuntimeState* state, VExprContext* context,
FunctionContext::FunctionStateScope scope) {
CaseState* case_state = reinterpret_cast<CaseState*>(
context->fn_context(_fn_context_index)
->get_function_state(FunctionContext::FRAGMENT_LOCAL));
delete case_state;
VExpr::close_function_context(context, scope, _function);
VExpr::close(state, context, scope);
}