]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cephfs: fix a memory leak
authorXiao Guodong <xiaogd@inspur.com>
Thu, 25 Jul 2019 06:50:49 +0000 (14:50 +0800)
committerXiao Guodong <xiaogd@inspur.com>
Thu, 25 Jul 2019 09:41:02 +0000 (17:41 +0800)
use a smart pointer instead of using 'new' to resolve a memory leak .

Fixes: https://tracker.ceph.com/issues/40936
Signed-off-by: XiaoGuoDong2019 <xiaogd@inspur.com>
src/tools/cephfs/Resetter.cc

index bd048c2e4593503e0584e12eaee456d886e0929c..8ab134f8d61235bff7e0be3f2e82dfa48a43aec7 100644 (file)
@@ -11,7 +11,7 @@
  * Foundation.  See file COPYING.
  * 
  */
-
+#include <memory>
 #include "common/errno.h"
 #include "osdc/Journaler.h"
 #include "mds/JournalPointer.h"
@@ -196,7 +196,7 @@ int Resetter::_write_reset_event(Journaler *journaler)
 {
   ceph_assert(journaler != NULL);
 
-  LogEvent *le = new EResetJournal;
+  auto le = std::make_unique<EResetJournal>();
 
   bufferlist bl;
   le->encode_with_header(bl, CEPH_FEATURES_SUPPORTED_DEFAULT);