From: Or Ozeri Date: Thu, 25 Nov 2021 13:47:54 +0000 (+0200) Subject: librbd/crypto: fix memory leak in ShutDownCryptoRequest X-Git-Tag: v17.1.0~358^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=044280dcbe808d76cb2c97e1457685d76e8c869a;p=ceph.git librbd/crypto: fix memory leak in ShutDownCryptoRequest If crypto object dispatch does not exist, a context pointer is leaked. This commit fixes this issue. Signed-off-by: Or Ozeri --- diff --git a/src/librbd/crypto/ShutDownCryptoRequest.cc b/src/librbd/crypto/ShutDownCryptoRequest.cc index dad6e2fc192..bc3e47bb11c 100644 --- a/src/librbd/crypto/ShutDownCryptoRequest.cc +++ b/src/librbd/crypto/ShutDownCryptoRequest.cc @@ -39,15 +39,16 @@ void ShutDownCryptoRequest::send() { template void ShutDownCryptoRequest::shut_down_object_dispatch() { - auto ctx = create_context_callback< - ShutDownCryptoRequest, - &ShutDownCryptoRequest::handle_shut_down_object_dispatch>(this); if (!m_image_ctx->io_object_dispatcher->exists( io::OBJECT_DISPATCH_LAYER_CRYPTO)) { finish(0); return; } + auto ctx = create_context_callback< + ShutDownCryptoRequest, + &ShutDownCryptoRequest::handle_shut_down_object_dispatch>(this); + m_image_ctx->io_object_dispatcher->shut_down_dispatch( io::OBJECT_DISPATCH_LAYER_CRYPTO, ctx); }