From: Yehuda Sadeh Date: Thu, 8 Nov 2018 22:03:43 +0000 (-0800) Subject: rgw: fix uninitialized access X-Git-Tag: v14.1.0~898^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8010f2139174b9833a71565625efc502c7967088;p=ceph.git rgw: fix uninitialized access Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/services/svc_finisher.h b/src/rgw/services/svc_finisher.h index c1ae589e9dc1..116fd8fded07 100644 --- a/src/rgw/services/svc_finisher.h +++ b/src/rgw/services/svc_finisher.h @@ -20,7 +20,7 @@ private: void shutdown() override; std::map shutdown_cbs; - std::atomic handles_counter; + std::atomic handles_counter{0}; protected: void init() {} diff --git a/src/rgw/services/svc_notify.cc b/src/rgw/services/svc_notify.cc index 2cbbdcb66eab..466b9d0696d1 100644 --- a/src/rgw/services/svc_notify.cc +++ b/src/rgw/services/svc_notify.cc @@ -260,7 +260,9 @@ int RGWSI_Notify::do_start() } shutdown_cb = new RGWSI_Notify_ShutdownCB(this); - finisher_svc->register_caller(shutdown_cb, &finisher_handle); + int handle; + finisher_svc->register_caller(shutdown_cb, &handle); + finisher_handle = handle; return 0; } @@ -271,7 +273,9 @@ void RGWSI_Notify::shutdown() return; } - finisher_svc->unregister_caller(finisher_handle); + if (finisher_handle) { + finisher_svc->unregister_caller(*finisher_handle); + } finalize_watch(); delete shutdown_cb; diff --git a/src/rgw/services/svc_notify.h b/src/rgw/services/svc_notify.h index ca72c59e9ea6..cd9d9eb89d97 100644 --- a/src/rgw/services/svc_notify.h +++ b/src/rgw/services/svc_notify.h @@ -45,7 +45,7 @@ private: CB *cb{nullptr}; - int finisher_handle{0}; + std::optional finisher_handle; RGWSI_Notify_ShutdownCB *shutdown_cb{nullptr}; bool finalized{false};