]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephfs: fix a memory leak 29915/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 23:52:01 +0000 (19:52 -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 9573e6a6239e1b1f529ee40070078f6e2aa9c57c..74573a12bcfa1a8b225f8c4a280041d1afc58cce 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)
 {
   assert(journaler != NULL);
 
-  LogEvent *le = new EResetJournal;
+  auto le = std::make_unique<EResetJournal>();
 
   bufferlist bl;
   le->encode_with_header(bl, CEPH_FEATURES_SUPPORTED_DEFAULT);