From 4babd3fa335351bd4327cded47a1ffe5a8cfd897 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Sat, 17 Sep 2016 08:29:15 -0400 Subject: [PATCH] librbd: corrected use-after-free in ImageWatcher Fixes: http://tracker.ceph.com/issues/17289 Signed-off-by: Jason Dillaman (cherry picked from commit 2f4d4868e3b721c932c35ae7e8f0dd96b36a37fc) --- src/librbd/ImageWatcher.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/librbd/ImageWatcher.cc b/src/librbd/ImageWatcher.cc index c828163b8adb4..38083b42a5f43 100644 --- a/src/librbd/ImageWatcher.cc +++ b/src/librbd/ImageWatcher.cc @@ -61,9 +61,10 @@ struct C_UnwatchAndFlush : public Context { // to completing the callback to avoid racing an explicit // librados shutdown Context *ctx = on_finish; + r = ret_val; delete this; - ctx->complete(ret_val); + ctx->complete(r); } virtual void finish(int r) override { -- 2.39.5