Skip to content

Commit

Permalink
FrameReader: Fix leak
Browse files Browse the repository at this point in the history
  • Loading branch information
syyyr authored and fvacek committed Nov 5, 2024
1 parent 706dd41 commit 2ceb06d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libshviotqt/src/rpc/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ int FrameReader::tryToReadMeta(std::istringstream &in)
static constexpr auto protocol_chainpack = static_cast<int>(shv::chainpack::Rpc::ProtocolType::ChainPack);
static constexpr auto protocol_cpon = static_cast<int>(shv::chainpack::Rpc::ProtocolType::Cpon);
auto protocol = in.get();
AbstractStreamReader *rd = nullptr;
std::unique_ptr<AbstractStreamReader> rd;
if (protocol == protocol_cpon) {
m_protocol = shv::chainpack::Rpc::ProtocolType::Cpon;
rd = new chainpack::CponReader(in);
rd = std::make_unique<chainpack::CponReader>(in);
}
else if (protocol == protocol_chainpack) {
m_protocol = shv::chainpack::Rpc::ProtocolType::ChainPack;
rd = new chainpack::ChainPackReader(in);
rd = std::make_unique<chainpack::ChainPackReader>(in);
}
if (rd) {
try {
Expand Down

0 comments on commit 2ceb06d

Please sign in to comment.