From 6fa8fa66aa43abc37eea249b9686ab4567310404 Mon Sep 17 00:00:00 2001 From: Daniel Richman Date: Thu, 27 Dec 2012 14:22:24 +0000 Subject: [PATCH] Fix memory leak (oops) --- src/RFC3339.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/RFC3339.cxx b/src/RFC3339.cxx index 54b1a1f..38b3f3d 100644 --- a/src/RFC3339.cxx +++ b/src/RFC3339.cxx @@ -95,7 +95,15 @@ void StrictInt::extract(istream &in) return; } - char *temp = new char[length + 1]; + /* len(str(2**32)) == 10 */ + if (length >= 11) + { + in.setstate(ios_base::badbit); + return; + } + + char temp[16]; + in.read(temp, length); temp[length] = 0;