]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephfs: fix a memory leak 29879/head
authorXiao Guodong <xiaogd@inspur.com>
Thu, 25 Jul 2019 06:50:49 +0000 (14:50 +0800)
committerPrashant D <pdhange@redhat.com>
Mon, 26 Aug 2019 00:54:42 +0000 (20:54 -0400)
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>
(cherry picked from commit 648730c6028d54f6143d130d4882c66bf06453cd)

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);