diff --git a/libshviotqt/src/rpc/socket.cpp b/libshviotqt/src/rpc/socket.cpp index eba82884..83d9b4c0 100644 --- a/libshviotqt/src/rpc/socket.cpp +++ b/libshviotqt/src/rpc/socket.cpp @@ -75,14 +75,14 @@ int FrameReader::tryToReadMeta(std::istringstream &in) static constexpr auto protocol_chainpack = static_cast(shv::chainpack::Rpc::ProtocolType::ChainPack); static constexpr auto protocol_cpon = static_cast(shv::chainpack::Rpc::ProtocolType::Cpon); auto protocol = in.get(); - AbstractStreamReader *rd = nullptr; + std::unique_ptr rd; if (protocol == protocol_cpon) { m_protocol = shv::chainpack::Rpc::ProtocolType::Cpon; - rd = new chainpack::CponReader(in); + rd = std::make_unique(in); } else if (protocol == protocol_chainpack) { m_protocol = shv::chainpack::Rpc::ProtocolType::ChainPack; - rd = new chainpack::ChainPackReader(in); + rd = std::make_unique(in); } if (rd) { try {