]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix a potential leak
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 21 Jan 2020 21:20:30 +0000 (13:20 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 28 Jan 2020 18:20:40 +0000 (10:20 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/services/svc_zone.cc

index 404937574c968e30d5c49fb347e632b5ceb3d492..770cf983849299cabd09b38a47fd9b392d951a71 100644 (file)
@@ -169,13 +169,13 @@ int RGWSI_Zone::do_start()
   zone_short_id = current_period->get_map().get_zone_short_id(zone_params->get_id());
 
   for (auto ziter : zonegroup->zones) {
-    auto zone_handler = new RGWBucketSyncPolicyHandler(this, sync_modules_svc, bucket_sync_svc, ziter.second.id);
+    auto zone_handler = std::make_shared<RGWBucketSyncPolicyHandler>(this, sync_modules_svc, bucket_sync_svc, ziter.second.id);
     ret = zone_handler->init(null_yield);
     if (ret < 0) {
       lderr(cct) << "ERROR: could not initialize zone policy handler for zone=" << ziter.second.name << dendl;
       return ret;
       }
-    sync_policy_handlers[ziter.second.id].reset(zone_handler);
+    sync_policy_handlers[ziter.second.id] = zone_handler;
   }
 
   sync_policy_handler = sync_policy_handlers[zone_id()]; /* we made sure earlier that zonegroup->zones has our zone */