]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix resource leak in rgw_bucket.cc and rgw_user.cc 17570/head
authorLuo Kexue <luo.kexue@zte.com.cn>
Wed, 30 Aug 2017 01:32:18 +0000 (09:32 +0800)
committerAbhishek Lekshmanan <abhishek@suse.com>
Thu, 14 Sep 2017 09:35:26 +0000 (11:35 +0200)
Fixes: http://tracker.ceph.com/issues/21214
Signed-off-by: Luo Kexue <luo.kexue@zte.com.cn>
(cherry picked from commit 1f23976adab74e25ce06941692a881521885c6ee)

src/rgw/rgw_bucket.cc
src/rgw/rgw_user.cc

index ff68a30af1e440a9855bf06afb0e6141eeb2fff3..0da6dd587b672226d14d35bdd9967d840954d713 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "common/errno.h"
 #include "common/ceph_json.h"
+#include "common/backport14.h"
 #include "rgw_rados.h"
 #include "rgw_acl.h"
 #include "rgw_acl_s3.h"
@@ -2165,7 +2166,7 @@ public:
   }
 
   int list_keys_init(RGWRados *store, const string& marker, void **phandle) override {
-    list_keys_info *info = new list_keys_info;
+    auto info = ceph::make_unique<list_keys_info>();
 
     info->store = store;
 
@@ -2174,7 +2175,7 @@ public:
     if (ret < 0) {
       return ret;
     }
-    *phandle = (void *)info;
+    *phandle = (void *)info.release();
 
     return 0;
   }
@@ -2364,7 +2365,7 @@ public:
   }
 
   int list_keys_init(RGWRados *store, const string& marker, void **phandle) override {
-    list_keys_info *info = new list_keys_info;
+    auto info = ceph::make_unique<list_keys_info>();
 
     info->store = store;
 
@@ -2373,7 +2374,7 @@ public:
     if (ret < 0) {
       return ret;
     }
-    *phandle = (void *)info;
+    *phandle = (void *)info.release();
 
     return 0;
   }
index 0fa690b590ff4e37e875c3ee5cea670cd8f4ef71..ebe795e7d6f6bb5deac831d4d87000ce9171b96d 100644 (file)
@@ -11,6 +11,7 @@
 #include "common/Formatter.h"
 #include "common/ceph_json.h"
 #include "common/RWLock.h"
+#include "common/backport14.h"
 #include "rgw_rados.h"
 #include "rgw_acl.h"
 
@@ -2774,7 +2775,7 @@ public:
 
   int list_keys_init(RGWRados *store, const string& marker, void **phandle) override
   {
-    list_keys_info *info = new list_keys_info;
+    auto info = ceph::make_unique<list_keys_info>();
 
     info->store = store;
 
@@ -2784,7 +2785,7 @@ public:
       return ret;
     }
 
-    *phandle = (void *)info;
+    *phandle = (void *)info.release();
 
     return 0;
   }