From b109a1c3962a9f45fb5819afd69c7caaf78eb35e Mon Sep 17 00:00:00 2001 From: practicalswift Date: Wed, 28 Jun 2017 23:14:48 +0200 Subject: [PATCH] Remove redundant nullptr checks before deallocation Rationale: * delete ptr is a no-op if ptr is nullptr --- src/net.cpp | 3 +-- src/qt/paymentrequestplus.cpp | 3 +-- src/qt/paymentserver.cpp | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/net.cpp b/src/net.cpp index 599a6128fa..c5bca8add9 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -2753,8 +2753,7 @@ CNode::~CNode() { CloseSocket(hSocket); - if (pfilter) - delete pfilter; + delete pfilter; } void CNode::AskFor(const CInv& inv) diff --git a/src/qt/paymentrequestplus.cpp b/src/qt/paymentrequestplus.cpp index 0a5cb98668..872e0e321a 100644 --- a/src/qt/paymentrequestplus.cpp +++ b/src/qt/paymentrequestplus.cpp @@ -194,8 +194,7 @@ bool PaymentRequestPlus::getMerchant(X509_STORE* certStore, QString& merchant) c qWarning() << "PaymentRequestPlus::getMerchant: SSL error: " << err.what(); } - if (website) - delete[] website; + delete[] website; X509_STORE_CTX_free(store_ctx); for (unsigned int i = 0; i < certs.size(); i++) X509_free(certs[i]); diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp index 67fe320185..9c1c206d8c 100644 --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -364,8 +364,7 @@ void PaymentServer::initNetManager() { if (!optionsModel) return; - if (netManager != nullptr) - delete netManager; + delete netManager; // netManager is used to fetch paymentrequests given in bitcoin: URIs netManager = new QNetworkAccessManager(this);