diff --git a/cpp/src/arrow/status.cc b/cpp/src/arrow/status.cc index 50eb001c3a7..5e54c267fbe 100644 --- a/cpp/src/arrow/status.cc +++ b/cpp/src/arrow/status.cc @@ -32,9 +32,7 @@ Status::Status(StatusCode code, std::string msg, std::shared_ptr d void Status::CopyFrom(const Status& s) { if (ARROW_PREDICT_FALSE(state_ != NULL)) { - if (!state_->is_constant) { - DeleteState(); - } + DeleteState(); } if (s.state_ == nullptr) { state_ = nullptr; diff --git a/cpp/src/arrow/status.h b/cpp/src/arrow/status.h index 5757440cee7..39f31141e84 100644 --- a/cpp/src/arrow/status.h +++ b/cpp/src/arrow/status.h @@ -148,11 +148,12 @@ class ARROW_EXPORT [[nodiscard]] Status : public util::EqualityComparableis_constant) { - DeleteState(); - } + DeleteState(); } } @@ -409,7 +410,9 @@ class ARROW_EXPORT [[nodiscard]] Status : public util::EqualityComparableis_constant) { + delete state_; + } } void CopyFrom(const Status& s); inline void MoveFrom(Status& s); @@ -419,9 +422,7 @@ class ARROW_EXPORT [[nodiscard]] Status : public util::EqualityComparableis_constant) { - DeleteState(); - } + DeleteState(); } state_ = s.state_; s.state_ = NULLPTR;