Skip to content

Commit 3bae57a

Browse files
laanwjPastaPastaPasta
authored andcommitted
Merge bitcoin#10696: Remove redundant nullptr checks before deallocation
b109a1c Remove redundant nullptr checks before deallocation (practicalswift) Pull request description: Rationale: * `delete ptr` is a no-op if `ptr` is `nullptr` Tree-SHA512: c98ce769125c4912186a8403cc08a59cfba85b7141af645c709b4c4eb90dd9cbdd6ed8076d50099d1e4ec2bf75917d1af6844082ec42bbb4d94d229a710e051c
1 parent 79e841f commit 3bae57a

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

src/net.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3239,8 +3239,7 @@ CNode::~CNode()
32393239
{
32403240
CloseSocket(hSocket);
32413241

3242-
if (pfilter)
3243-
delete pfilter;
3242+
delete pfilter;
32443243
}
32453244

32463245
void CNode::AskFor(const CInv& inv, int64_t doubleRequestDelay)

src/qt/paymentrequestplus.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,7 @@ bool PaymentRequestPlus::getMerchant(X509_STORE* certStore, QString& merchant) c
197197
qWarning() << "PaymentRequestPlus::getMerchant: SSL error: " << err.what();
198198
}
199199

200-
if (website)
201-
delete[] website;
200+
delete[] website;
202201
X509_STORE_CTX_free(store_ctx);
203202
for (unsigned int i = 0; i < certs.size(); i++)
204203
X509_free(certs[i]);

src/qt/paymentserver.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,7 @@ void PaymentServer::initNetManager()
363363
{
364364
if (!optionsModel)
365365
return;
366-
if (netManager != nullptr)
367-
delete netManager;
366+
delete netManager;
368367

369368
// netManager is used to fetch paymentrequests given in dash: URIs
370369
netManager = new QNetworkAccessManager(this);

0 commit comments

Comments
 (0)