]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/Monitor: fix memory leak
authorxie xingguo <xie.xingguo@zte.com.cn>
Wed, 4 May 2016 07:03:55 +0000 (15:03 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Tue, 10 May 2016 04:19:20 +0000 (12:19 +0800)
Fixes: http://tracker.ceph.com/issues/15793
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/mon/Monitor.cc

index 71c3727005892b7dc788fd20357f032f019d8772..6959efe3ed1d10603b4ebab754dd8df95141d347 100644 (file)
@@ -3762,14 +3762,14 @@ void Monitor::handle_ping(MonOpRequestRef op)
   MPing *reply = new MPing;
   entity_inst_t inst = m->get_source_inst();
   bufferlist payload;
-  Formatter *f = new JSONFormatter(true);
+  boost::scoped_ptr<Formatter> f(new JSONFormatter(true));
   f->open_object_section("pong");
 
   list<string> health_str;
-  get_health(health_str, NULL, f);
+  get_health(health_str, NULL, f.get());
   {
     stringstream ss;
-    get_mon_status(f, ss);
+    get_mon_status(f.get(), ss);
   }
 
   f->close_section();