From: Mykola Golub Date: Mon, 11 Dec 2017 20:56:40 +0000 (+0200) Subject: test/rbd_mirror: "use of uninitialised value" valgrind warning X-Git-Tag: v13.0.2~817^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F19437%2Fhead;p=ceph.git test/rbd_mirror: "use of uninitialised value" valgrind warning The `on_call` context serves as a barrier and should be completed after the `on_start_ctx` context is assigned. The warning was observed sporadically e.g. by repeating WaitingOnNonLeaderAcquireLeader test under valgrind. Signed-off-by: Mykola Golub --- diff --git a/src/test/rbd_mirror/test_mock_InstanceWatcher.cc b/src/test/rbd_mirror/test_mock_InstanceWatcher.cc index 69497d3918ce..3cb860e6699e 100644 --- a/src/test/rbd_mirror/test_mock_InstanceWatcher.cc +++ b/src/test/rbd_mirror/test_mock_InstanceWatcher.cc @@ -692,14 +692,14 @@ public: EXPECT_CALL(mock_image_sync_throttler, start_op(sync_id, _)) .WillOnce(Invoke([on_call, on_start_ctx] (const std::string &, Context *ctx) { - if (on_call != nullptr) { - on_call->complete(0); - } if (on_start_ctx != nullptr) { *on_start_ctx = ctx; } else { ctx->complete(0); } + if (on_call != nullptr) { + on_call->complete(0); + } })); }