Merge pull request #245 from wincsb/master

fix memory leak
This commit is contained in:
ruanshudong 2022-08-05 10:33:50 +08:00 committed by GitHub
commit a028cd1e44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -498,7 +498,7 @@ TC_NetWorkBuffer::PACKET_TYPE ProxyProtocol::http1Response(TC_NetWorkBuffer &in,
{
context = new shared_ptr<TC_HttpResponse>();
*context = std::make_shared<TC_HttpResponse>();
in.setContextData(context, [](TC_NetWorkBuffer*nb){ shared_ptr<TC_HttpResponse> *p = (shared_ptr<TC_HttpResponse>*)(nb->getContextData()); if(!p) { nb->setContextData(NULL); delete p; }});
in.setContextData(context, [](TC_NetWorkBuffer*nb){ shared_ptr<TC_HttpResponse> *p = (shared_ptr<TC_HttpResponse>*)(nb->getContextData()); if(p) { nb->setContextData(NULL); delete p; }});
}
if((*context)->incrementDecode(in))