[fix](memory) Fix AggFunc memory leak due to incorrect destroy (#19126)
This commit is contained in:
@ -631,7 +631,14 @@ Status AggregationNode::close(RuntimeState* state) {
|
||||
|
||||
Status AggregationNode::_create_agg_status(AggregateDataPtr data) {
|
||||
for (int i = 0; i < _aggregate_evaluators.size(); ++i) {
|
||||
_aggregate_evaluators[i]->create(data + _offsets_of_aggregate_states[i]);
|
||||
try {
|
||||
_aggregate_evaluators[i]->create(data + _offsets_of_aggregate_states[i]);
|
||||
} catch (...) {
|
||||
for (int j = 0; j < i; ++j) {
|
||||
_aggregate_evaluators[j]->destroy(data + _offsets_of_aggregate_states[j]);
|
||||
}
|
||||
throw;
|
||||
}
|
||||
}
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user