From: Matt Benjamin Date: Tue, 2 Jan 2018 19:16:11 +0000 (-0500) Subject: rgw: don't leak S3 LDAPHelper on shutdown X-Git-Tag: v13.0.2~244^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e56d4d4265ea8a642ba1143323e11bd0fa7a7b06;p=ceph.git rgw: don't leak S3 LDAPHelper on shutdown Adds a static shutdown() method to rgw::auth::s3::LDAPEngine, and calls it from main. Signed-off-by: Matt Benjamin --- diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc index aaa57ae0ef31..b742d2e5673f 100644 --- a/src/rgw/rgw_main.cc +++ b/src/rgw/rgw_main.cc @@ -568,7 +568,7 @@ int main(int argc, const char **argv) delete olog; RGWStoreManager::close_storage(store); - + rgw::auth::s3::LDAPEngine::shutdown(); rgw_tools_cleanup(); rgw_shutdown_resolver(); curl_global_cleanup(); diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index 93a20087d607..0321c6e98315 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -4137,8 +4137,14 @@ rgw::auth::s3::LDAPEngine::authenticate( auto apl = apl_factory->create_apl_remote(cct, s, get_acl_strategy(), get_creds_info(base64_token)); return result_t::grant(std::move(apl), completer_factory(boost::none)); -} +} /* rgw::auth::s3::LDAPEngine::authenticate */ +void rgw::auth::s3::LDAPEngine::shutdown() { + if (ldh) { + delete ldh; + ldh = nullptr; + } +} /* LocalEndgine */ rgw::auth::Engine::result_t diff --git a/src/rgw/rgw_rest_s3.h b/src/rgw/rgw_rest_s3.h index 65b205287337..20c4b2d66932 100644 --- a/src/rgw/rgw_rest_s3.h +++ b/src/rgw/rgw_rest_s3.h @@ -850,6 +850,8 @@ public: const char* get_name() const noexcept override { return "rgw::auth::s3::LDAPEngine"; } + + static void shutdown(); };