fix SeArray memory leak when deserializing rcode_.warnings_

This commit is contained in:
liucc1997
2023-05-17 13:46:26 +00:00
committed by ob-robot
parent d07260f033
commit 29be7ce8ce
2 changed files with 26 additions and 17 deletions

View File

@ -87,6 +87,9 @@ ObAsyncRespCallback* ObAsyncRespCallback::create(ObRpcMemPool& pool, UAsyncCB* u
RPC_LOG(WARN, "ucb.clone fail", K(ret));
} else {
cb->low_level_cb_ = pcb;
if (cb != ucb) {
cb->set_cloned(true);
}
}
}
new(pcb)ObAsyncRespCallback(pool, cb);
@ -107,7 +110,9 @@ int ObAsyncRespCallback::handle_resp(int io_err, const char* buf, int64_t sz)
}
if (ucb_ == NULL) {
// do nothing
} else if (0 != io_err) {
} else {
bool cb_cloned = ucb_->get_cloned();
if (0 != io_err) {
ucb_->set_error(io_err);
if (OB_SUCCESS != ucb_->on_error(io_err)) {
ucb_->on_timeout();
@ -126,6 +131,10 @@ int ObAsyncRespCallback::handle_resp(int io_err, const char* buf, int64_t sz)
RPC_LOG(WARN, "ucb.process fail", K(tmp_ret));
}
}
if (cb_cloned) {
ucb_->~AsyncCB();
}
}
pool_.destroy();
return ret;
}

View File

@ -92,7 +92,7 @@ int wq_flush(sock_t* s, write_queue_t* wq, dlink_t** old_head) {
int err = 0;
int64_t wbytes = 0;
err = sk_flush_blist((sock_t*)s, &wq->queue.head, wq->pos, &wbytes);
if (0 == err) {
if (0 == err && wbytes > 0) {
*old_head = wq_consume(wq, wbytes);
}
return err;