From abad903f31b26be85c0de8aebc1ceb7270fd471b Mon Sep 17 00:00:00 2001 From: Niels Date: Fri, 5 Jul 2013 11:57:12 +0200 Subject: [PATCH] - memory problem --- src/JSON.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/JSON.cc b/src/JSON.cc index 8095a0366..ec495fd5a 100644 --- a/src/JSON.cc +++ b/src/JSON.cc @@ -591,11 +591,11 @@ JSON::parser::parser(std::string& s) : _pos(0) { JSON::parser::parser(std::istream& _is) : _pos(0) { // determine length of input stream _is.seekg(0, std::ios::end); - std::streampos length = _is.tellg(); + size_t length = _is.tellg(); _is.seekg(0, std::ios::beg); // copy stream to buffer - _buffer = new char[length]; + _buffer = new char[length + 1]; _is.read(_buffer, length); // read first character