]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
formatter: no need for dynamic allocation
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 24 Oct 2014 22:18:02 +0000 (15:18 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Mon, 19 Jan 2015 23:57:47 +0000 (15:57 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/common/Formatter.cc

index 63e8252fa9411a51850e14961c7aa60fff2ef3c6..3394e9fc515907fa8e88c573604b36e8169bbaf7 100644 (file)
@@ -158,10 +158,9 @@ void JSONFormatter::print_comma(json_formatter_stack_entry_d& entry)
 void JSONFormatter::print_quoted_string(const std::string& s)
 {
   int len = escape_json_attr_len(s.c_str(), s.size());
-  char *escaped = new char[len];
+  char escaped[len];
   escape_json_attr(s.c_str(), s.size(), escaped);
   m_ss << '\"' << escaped << '\"';
-  delete[] escaped;
 }
 
 void JSONFormatter::print_name(const char *name)