From 48bbf8088627ae4cb83763656a0fec15d58d849c Mon Sep 17 00:00:00 2001 From: Ben Boeckel <ben.boeckel@kitware.com> Date: Sun, 17 Oct 2021 16:56:52 -0400 Subject: [PATCH] clang-tidy: fix `readability-delete-null-pointer` lints --- Common/DataModel/vtkStaticCellLinksTemplate.txx | 10 ++-------- IO/PIO/PIOData.h | 6 ++---- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Common/DataModel/vtkStaticCellLinksTemplate.txx b/Common/DataModel/vtkStaticCellLinksTemplate.txx index 207d49ed953..6d2bb9035d6 100644 --- a/Common/DataModel/vtkStaticCellLinksTemplate.txx +++ b/Common/DataModel/vtkStaticCellLinksTemplate.txx @@ -641,17 +641,11 @@ void vtkStaticCellLinksTemplate<TIds>::DeepCopy(vtkAbstractCellLinks* src) this->NumPts = links->NumPts; this->NumCells = links->NumCells; - if (this->Links != nullptr) - { - delete[] this->Links; - } + delete[] this->Links; this->Links = new TIds[this->LinksSize + 1]; std::copy(links->Links, links->Links + (this->LinksSize + 1), this->Links); - if (this->Offsets != nullptr) - { - delete[] this->Offsets; - } + delete[] this->Offsets; this->Offsets = new TIds[this->NumPts + 1]; std::copy(links->Offsets, links->Offsets + (this->NumPts + 1), this->Offsets); } diff --git a/IO/PIO/PIOData.h b/IO/PIO/PIOData.h index 2a27c6b92e3..3a0a5bbc210 100644 --- a/IO/PIO/PIOData.h +++ b/IO/PIO/PIOData.h @@ -130,8 +130,7 @@ private: { if (size_buf < (size_t)size) { - if (buf) - delete[] buf; + delete[] buf; size_buf = size; buf = new char[size_buf]; } @@ -175,8 +174,7 @@ private: { if (size_buf <= len) { - if (buf) - delete[] buf; + delete[] buf; size_buf = len + 1; buf = new char[size_buf]; } -- GitLab