Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions include/pion/http/writer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,17 +305,12 @@ class PION_API writer :


/// used to cache binary data included within the payload content
class binary_cache_t : public std::vector<std::pair<const char *, size_t> > {
class binary_cache_t : public std::vector<std::pair<std::unique_ptr<const char>, size_t>> {
public:
~binary_cache_t() {
for (iterator i=begin(); i!=end(); ++i) {
delete[] i->first;
}
}
inline boost::asio::const_buffer add(const void *ptr, const size_t size) {
char *data_ptr = new char[size];
memcpy(data_ptr, ptr, size);
push_back( std::make_pair(data_ptr, size) );
push_back(std::make_pair(std::unique_ptr<const char>{data_ptr}, size ) );
return boost::asio::buffer(data_ptr, size);
}
};
Expand Down