]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix resource leak in rgw_bucket.cc and rgw_user.cc 17353/head
authorLuo Kexue <luo.kexue@zte.com.cn>
Wed, 30 Aug 2017 01:32:18 +0000 (09:32 +0800)
committerLuo Kexue <luo.kexue@zte.com.cn>
Fri, 1 Sep 2017 15:11:11 +0000 (23:11 +0800)
Fixes: http://tracker.ceph.com/issues/21214
Signed-off-by: Luo Kexue <luo.kexue@zte.com.cn>
src/rgw/rgw_bucket.cc
src/rgw/rgw_user.cc

index 17dbe3d49c7684f31169992be500fb528eccbde8..ae6ce0163602ef1c310cd8abb37dcd04e855515e 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"
@@ -2162,7 +2163,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;
 
@@ -2171,7 +2172,7 @@ public:
     if (ret < 0) {
       return ret;
     }
-    *phandle = (void *)info;
+    *phandle = (void *)info.release();
 
     return 0;
   }
@@ -2361,7 +2362,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;
 
@@ -2370,7 +2371,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;
   }