diff --git a/server/wsproxy/mastermgr.cc b/server/wsproxy/mastermgr.cc index 6a965aa..5c4756a 100644 --- a/server/wsproxy/mastermgr.cc +++ b/server/wsproxy/mastermgr.cc @@ -75,6 +75,7 @@ void MasterMgr::_SS_MS_ResponseTargetServer(f8::MsgHdr* hdr, const ss::SS_MS_Res ); if (!conn.expired()) { conn.lock()->ForwardClientMsgEx(req->hdr_copy); + f8::MsgHdr::Destroy(req->hdr_copy); req->conn = conn; req->hdr_copy = nullptr; if (!req->timer_wp.expired()) { diff --git a/server/wsproxy/upstream.cc b/server/wsproxy/upstream.cc index 8e9ac9f..1dc9f55 100644 --- a/server/wsproxy/upstream.cc +++ b/server/wsproxy/upstream.cc @@ -137,10 +137,6 @@ void UpStream::ForwardClientMsgEx(f8::MsgHdr* hdr) SendStockMsg(); } ForwardClientMsg(hdr); - if (hdr->buf) { - free((char*)hdr->buf); - } - free(hdr); } else { AddStockMsg(hdr->socket_handle, 0, nullptr, hdr); } @@ -266,13 +262,17 @@ void UpStream::CheckAlive() } void UpStream::AddStockMsg(unsigned short socket_handle, int msgid, ::google::protobuf::Message* msg, - f8::MsgHdr* hdr) + f8::MsgHdr* hdr) { UpStreamMsgNode* node = new UpStreamMsgNode(); node->socket_handle = socket_handle; node->msgid = msgid; node->msg = msg; - node->hdr = hdr; + if (hdr) { + node->hdr = hdr->Clone(); + } else { + node->hdr = nullptr; + } if (bot_node_) { bot_node_->next_node = node; bot_node_ = node;