Bugfix for wm_concat memory leak
This commit is contained in:
@ -5703,6 +5703,7 @@ int ObAggregateProcessor::get_wm_concat_result(const ObAggrInfo &aggr_info,
|
|||||||
ObDatum &concat_result)
|
ObDatum &concat_result)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
|
ObArenaAllocator tmp_alloc;
|
||||||
if (OB_ISNULL(extra) || OB_UNLIKELY(extra->empty())) {
|
if (OB_ISNULL(extra) || OB_UNLIKELY(extra->empty())) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
LOG_WARN("get unpexcted null", K(ret), K(extra));
|
LOG_WARN("get unpexcted null", K(ret), K(extra));
|
||||||
@ -5745,7 +5746,7 @@ int ObAggregateProcessor::get_wm_concat_result(const ObAggrInfo &aggr_info,
|
|||||||
const bool has_lob_header = aggr_info.expr_->args_[0]->obj_meta_.has_lob_header();
|
const bool has_lob_header = aggr_info.expr_->args_[0]->obj_meta_.has_lob_header();
|
||||||
ObString cell_string;
|
ObString cell_string;
|
||||||
ObTextStringIter text_iter(datum_meta.type_, datum_meta.cs_type_, datum.get_string(), has_lob_header);
|
ObTextStringIter text_iter(datum_meta.type_, datum_meta.cs_type_, datum.get_string(), has_lob_header);
|
||||||
if (OB_FAIL(text_iter.init(0, NULL, &aggr_alloc_))) {
|
if (OB_FAIL(text_iter.init(0, NULL, &tmp_alloc))) {
|
||||||
LOG_WARN("fail to init text reader", K(ret), K(text_iter));
|
LOG_WARN("fail to init text reader", K(ret), K(text_iter));
|
||||||
} else if (OB_FAIL(text_iter.get_full_data(cell_string))) {
|
} else if (OB_FAIL(text_iter.get_full_data(cell_string))) {
|
||||||
LOG_WARN("fail to get full data", K(ret), K(text_iter));
|
LOG_WARN("fail to get full data", K(ret), K(text_iter));
|
||||||
@ -5758,10 +5759,11 @@ int ObAggregateProcessor::get_wm_concat_result(const ObAggrInfo &aggr_info,
|
|||||||
} else if (buf_len < append_len) {
|
} else if (buf_len < append_len) {
|
||||||
char *tmp_buf = NULL;
|
char *tmp_buf = NULL;
|
||||||
buf_len = append_len * 2;
|
buf_len = append_len * 2;
|
||||||
if (OB_ISNULL(tmp_buf = static_cast<char*>(aggr_alloc_.alloc(buf_len)))) {
|
if (OB_ISNULL(tmp_buf = static_cast<char*>(tmp_alloc.alloc(buf_len)))) {
|
||||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||||
LOG_WARN("fail alloc memory", K(tmp_buf), K(buf_len), K(ret));
|
LOG_WARN("fail alloc memory", K(tmp_buf), K(buf_len), K(ret));
|
||||||
} else {
|
} else {
|
||||||
|
// Note: buf may be nullptr, but str_len = 0 at that time, NO ISSUE
|
||||||
MEMCPY(tmp_buf, buf, str_len);
|
MEMCPY(tmp_buf, buf, str_len);
|
||||||
buf = tmp_buf;
|
buf = tmp_buf;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user