]> git.ipfire.org Git - thirdparty/squid.git/commit
Fix store_client caller memory leak on certain errors (#1347)
authorAlex Rousskov <rousskov@measurement-factory.com>
Tue, 27 Jun 2023 22:47:36 +0000 (22:47 +0000)
committerFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Wed, 11 Oct 2023 13:51:41 +0000 (15:51 +0200)
commitd189b5a5a5e705a16b2d12e4e37f96f647c0d74f
treee8c1bd1882ede9ff02f9bc82d07b02c09824ad05
parente731314e97aa3c966d51cae33979f546284623ce
Fix store_client caller memory leak on certain errors (#1347)

When a storeUnregister() code path destroys store_client before the
latter has a chance to deliver the answer, the cbdataReferenceDone()
call in store_client::finishCallback() is not reached, keeping the
callback data (e.g., clientReplyContext) alive forever. These
storeClientCopy() "cancellations" may happen, for example, when the
client-to-Squid connection is closed while store_client waits for Store.

Use CallbackData to guarantee cbdataReferenceDone() when store_client is
destructed before it can finishCallback(). These synchronous callbacks
will be replaced with AsyncCalls. For now, we use the "discouraged"
CallbackData API to accommodate the existing legacy callbacks.

Probably broken since 2002 commit fa80a8e.
src/StoreClient.h
src/store_client.cc