Skip to content

Commit

Permalink
Merge bitcoin#10696: Remove redundant nullptr checks before deallocation
Browse files Browse the repository at this point in the history
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
  • Loading branch information
laanwj authored and PastaPastaPasta committed Jan 12, 2020
1 parent b72f4f5 commit 660d380
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/net.cpp
Expand Up @@ -3239,8 +3239,7 @@ CNode::~CNode()
{
CloseSocket(hSocket);

if (pfilter)
delete pfilter;
delete pfilter;
}

void CNode::AskFor(const CInv& inv, int64_t doubleRequestDelay)
Expand Down
3 changes: 1 addition & 2 deletions src/qt/paymentrequestplus.cpp
Expand Up @@ -197,8 +197,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]);
Expand Down
3 changes: 1 addition & 2 deletions src/qt/paymentserver.cpp
Expand Up @@ -365,8 +365,7 @@ void PaymentServer::initNetManager()
{
if (!optionsModel)
return;
if (netManager != nullptr)
delete netManager;
delete netManager;

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

0 comments on commit 660d380

Please sign in to comment.