diff --git a/cpp/piscsi/piscsi_response.cpp b/cpp/piscsi/piscsi_response.cpp index 7cf244a795..d3edde27d3 100644 --- a/cpp/piscsi/piscsi_response.cpp +++ b/cpp/piscsi/piscsi_response.cpp @@ -83,11 +83,11 @@ void PiscsiResponse::GetDevice(const Device& device, PbDevice& pb_device, const pb_device.set_allocated_properties(GetDeviceProperties(device).release()); auto status = make_unique(); - pb_device.set_allocated_status(status.release()); status->set_protected_(device.IsProtected()); status->set_stopped(device.IsStopped()); status->set_removed(device.IsRemoved()); status->set_locked(device.IsLocked()); + pb_device.set_allocated_status(status.release()); if (device.SupportsParams()) { //NOSONAR The allocated memory is managed by protobuf for (const auto& [key, value] : device.GetParams()) {