From: Francesco Chemolli <5175948+kinkie@users.noreply.github.com> Date: Fri, 27 Oct 2023 16:11:34 +0000 (+0000) Subject: Do not double-check cbdataReferenceDone() argument (#1537) X-Git-Tag: SQUID_7_0_1~313 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8275c50cbd1505ab532480e83ce6058beac0e42e;p=thirdparty%2Fsquid.git Do not double-check cbdataReferenceDone() argument (#1537) cbdataReferenceDone internally checks that the argument is not null. Remove duplicate check from all callsites that have it --- diff --git a/src/StoreIOState.cc b/src/StoreIOState.cc index 38873cd7ec..3b77dbe51d 100644 --- a/src/StoreIOState.cc +++ b/src/StoreIOState.cc @@ -45,11 +45,8 @@ StoreIOState::~StoreIOState() { debugs(20,3, "StoreIOState::~StoreIOState: " << this); - if (read.callback_data) - cbdataReferenceDone(read.callback_data); - - if (callback_data) - cbdataReferenceDone(callback_data); + cbdataReferenceDone(read.callback_data); + cbdataReferenceDone(callback_data); } bool StoreIOState::touchingStoreEntry() const diff --git a/src/client_side.cc b/src/client_side.cc index b5fd933b36..c9a3a510a6 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -3918,8 +3918,7 @@ ConnStateData::unpinConnection(const bool andClose) { debugs(33, 3, pinning.serverConnection); - if (pinning.peer) - cbdataReferenceDone(pinning.peer); + cbdataReferenceDone(pinning.peer); if (Comm::IsConnOpen(pinning.serverConnection)) { if (pinning.closeHandler != nullptr) { diff --git a/src/client_side_request.cc b/src/client_side_request.cc index 91a289bfc5..5b5b5af808 100644 --- a/src/client_side_request.cc +++ b/src/client_side_request.cc @@ -105,8 +105,7 @@ ClientRequestContext::~ClientRequestContext() * still have one */ - if (http) - cbdataReferenceDone(http); + cbdataReferenceDone(http); delete error; debugs(85,3, "ClientRequestContext destructed, this=" << this); @@ -257,8 +256,7 @@ ClientHttpRequest::~ClientHttpRequest() delete calloutContext; - if (conn_) - cbdataReferenceDone(conn_); + cbdataReferenceDone(conn_); /* moving to the next connection is handled by the context free */ dlinkDelete(&active, &ClientActiveRequests); diff --git a/src/esi/Assign.cc b/src/esi/Assign.cc index 8fb062705e..35c09d737d 100644 --- a/src/esi/Assign.cc +++ b/src/esi/Assign.cc @@ -139,8 +139,7 @@ ESIAssign::makeUsable(esiTreeParentPtr aParent, ESIVarState &aVarState) const void ESIAssign::finish() { - if (varState) - cbdataReferenceDone (varState); + cbdataReferenceDone(varState); if (parent.getRaw()) parent = nullptr; diff --git a/src/esi/Esi.cc b/src/esi/Esi.cc index fc0443872b..c4e9194586 100644 --- a/src/esi/Esi.cc +++ b/src/esi/Esi.cc @@ -2185,8 +2185,7 @@ esiWhen::~esiWhen() { safe_free (unevaluatedExpression); - if (varState) - cbdataReferenceDone (varState); + cbdataReferenceDone(varState); } void diff --git a/src/fs/rock/RockIoState.cc b/src/fs/rock/RockIoState.cc index d86d6c21bc..59f638c451 100644 --- a/src/fs/rock/RockIoState.cc +++ b/src/fs/rock/RockIoState.cc @@ -58,8 +58,7 @@ Rock::IoState::~IoState() // assert(!readableAnchor_); assert(shutting_down || !writeableAnchor_); - if (callback_data) - cbdataReferenceDone(callback_data); + cbdataReferenceDone(callback_data); theFile = nullptr; e->unlock("rock I/O");