aboutsummaryrefslogtreecommitdiffstats
path: root/src/tls/tls_extensions.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-08-06 11:09:20 +0000
committerlloyd <[email protected]>2012-08-06 11:09:20 +0000
commit073c13fb4d7d025340b4d52b3d622873816a0d21 (patch)
treee0e004751d2fdc0558e63806ee3eb0ccf2afc39c /src/tls/tls_extensions.cpp
parent245625012c48d689ad4330320c9b5476c7f3b7bd (diff)
Use unique_ptr in Server_Kex_Exchange and Extensions
Diffstat (limited to 'src/tls/tls_extensions.cpp')
-rw-r--r--src/tls/tls_extensions.cpp24
1 files changed, 6 insertions, 18 deletions
diff --git a/src/tls/tls_extensions.cpp b/src/tls/tls_extensions.cpp
index d66b055c8..46c8dc5be 100644
--- a/src/tls/tls_extensions.cpp
+++ b/src/tls/tls_extensions.cpp
@@ -70,8 +70,8 @@ Extensions::Extensions(TLS_Data_Reader& reader)
const u16bit extension_size = reader.get_u16bit();
Extension* extn = make_extension(reader,
- extension_code,
- extension_size);
+ extension_code,
+ extension_size);
if(extn)
this->add(extn);
@@ -85,15 +85,14 @@ std::vector<byte> Extensions::serialize() const
{
std::vector<byte> buf(2); // 2 bytes for length field
- for(std::map<Handshake_Extension_Type, Extension*>::const_iterator i = extensions.begin();
- i != extensions.end(); ++i)
+ for(auto& extn : extensions)
{
- if(i->second->empty())
+ if(extn.second->empty())
continue;
- const u16bit extn_code = i->second->type();
+ const u16bit extn_code = extn.second->type();
- std::vector<byte> extn_val = i->second->serialize();
+ std::vector<byte> extn_val = extn.second->serialize();
buf.push_back(get_byte(0, extn_code));
buf.push_back(get_byte(1, extn_code));
@@ -116,17 +115,6 @@ std::vector<byte> Extensions::serialize() const
return buf;
}
-Extensions::~Extensions()
- {
- for(std::map<Handshake_Extension_Type, Extension*>::const_iterator i = extensions.begin();
- i != extensions.end(); ++i)
- {
- delete i->second;
- }
-
- extensions.clear();
- }
-
Server_Name_Indicator::Server_Name_Indicator(TLS_Data_Reader& reader,
u16bit extension_size)
{