From 2f61dd1c41b768f82aec57ae0a468065d5f88e55 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Sat, 3 Sep 2016 16:12:43 -0400 Subject: [PATCH] fix double free --- Datagram.cpp | 6 +++--- Tag.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Datagram.cpp b/Datagram.cpp index adecb41f..a3da6527 100644 --- a/Datagram.cpp +++ b/Datagram.cpp @@ -205,12 +205,12 @@ namespace datagram if(lease) { if(tunnel) - return DatagramSession::Info{new i2p::data::IdentHash(lease->tunnelGateway), new i2p::data::IdentHash(tunnel->GetEndpointIdentHash()), m_LastUse, m_LastSuccess}; + return DatagramSession::Info{new i2p::data::IdentHash(lease->tunnelGateway.data()), new i2p::data::IdentHash(tunnel->GetEndpointIdentHash().data()), m_LastUse, m_LastSuccess}; else - return DatagramSession::Info{new i2p::data::IdentHash(lease->tunnelGateway), nullptr, m_LastUse, m_LastSuccess}; + return DatagramSession::Info{new i2p::data::IdentHash(lease->tunnelGateway.data()), nullptr, m_LastUse, m_LastSuccess}; } else if(tunnel) - return DatagramSession::Info{nullptr, new i2p::data::IdentHash(tunnel->GetEndpointIdentHash()), m_LastUse, m_LastSuccess}; + return DatagramSession::Info{nullptr, new i2p::data::IdentHash(tunnel->GetEndpointIdentHash().data()), m_LastUse, m_LastSuccess}; else return DatagramSession::Info{nullptr, nullptr, m_LastUse, m_LastSuccess}; } diff --git a/Tag.h b/Tag.h index 4b393c57..0861cb8e 100644 --- a/Tag.h +++ b/Tag.h @@ -50,6 +50,8 @@ namespace data { return true; } + const uint8_t * data() const { return m_Buf; } + /** fill with a value */ void Fill(uint8_t c) {