From 2f4d4868e3b721c932c35ae7e8f0dd96b36a37fc 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 --- 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 21ca68c72ca..0a9c4590bb5 100644 --- a/src/librbd/ImageWatcher.cc +++ b/src/librbd/ImageWatcher.cc @@ -62,9 +62,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.47.3