diff options
-rw-r--r-- | http_connection.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/http_connection.cpp b/http_connection.cpp index 61928d3..4411a92 100644 --- a/http_connection.cpp +++ b/http_connection.cpp @@ -7,6 +7,7 @@ #include <boost/format.hpp> #include <boost/algorithm/string.hpp> #include <boost/lexical_cast.hpp> +#include <boost/scoped_array.hpp> #include <boost/filesystem/fstream.hpp> @@ -104,10 +105,9 @@ void HTTP::Connection::send_file(const fs::path& filename) { is.seekg(begin); - char* buf = new char[end - begin]; - is.read(buf, end - begin); - send_data(buf, is.gcount()); - delete buf; + boost::scoped_array<char> buf(new char[end-begin]); + is.read(buf.get(), end - begin); + send_data(buf.get(), is.gcount()); } else { add_header("Content-Length", boost::str(boost::format("%d") % length)); |