From 596a52595038e531fdab65815cc410c44c28b41a Mon Sep 17 00:00:00 2001 From: Glauber Costa Date: Fri, 18 May 2018 08:58:20 -0400 Subject: [PATCH] commitlog: don't move pointer to segment We are currently moving the pointer we acquired to the segment inside the lambda in which we'll handle the cycle. The problem is, we also use that same pointer inside the exception handler. If an exception happens we'll access it and we'll crash. Signed-off-by: Glauber Costa Message-Id: <20180518125820.10726-1-glauber@scylladb.com> --- db/commitlog/commitlog.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/commitlog/commitlog.cc b/db/commitlog/commitlog.cc index 2da44429db..f3d4fb2e62 100644 --- a/db/commitlog/commitlog.cc +++ b/db/commitlog/commitlog.cc @@ -728,7 +728,7 @@ public: */ auto me = shared_from_this(); auto fp = _file_pos; - return _pending_ops.wait_for_pending(timeout).then([me = std::move(me), fp, timeout] { + return _pending_ops.wait_for_pending(timeout).then([me, fp, timeout] { if (fp != me->_file_pos) { // some other request already wrote this buffer. // If so, wait for the operation at our intended file offset