Fixed memory leak in Alarm's move assignment

pull/31063/merge
edmondj 2 years ago committed by GitHub
parent 7b3977e9f1
commit cd4154f21d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      include/grpcpp/alarm.h

@ -72,8 +72,7 @@ class Alarm : private grpc::internal::GrpcLibrary {
/// Alarms are movable.
Alarm(Alarm&& rhs) noexcept : alarm_(rhs.alarm_) { rhs.alarm_ = nullptr; }
Alarm& operator=(Alarm&& rhs) noexcept {
alarm_ = rhs.alarm_;
rhs.alarm_ = nullptr;
std::swap(alarm_, rhs.alarm_);
return *this;
}

Loading…
Cancel
Save