From 6b2a270345b2fd4eb4a4787606690cba187ad0c3 Mon Sep 17 00:00:00 2001 From: Shuo Date: Wed, 19 Feb 2020 21:54:23 +0800 Subject: [PATCH] fix(asan): heap-use-after-free in pegasus_write_service.cpp (#478) --- src/server/pegasus_write_service.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/server/pegasus_write_service.cpp b/src/server/pegasus_write_service.cpp index 09e50e12cb..bddccff2c7 100644 --- a/src/server/pegasus_write_service.cpp +++ b/src/server/pegasus_write_service.cpp @@ -297,16 +297,18 @@ int pegasus_write_service::duplicate(int64_t decree, resp.__set_error(_impl->multi_remove(ctx.decree, rpc.request(), rpc.response())); return resp.error; } + put_rpc put; + remove_rpc remove; if (request.task_code == dsn::apps::RPC_RRDB_RRDB_PUT || request.task_code == dsn::apps::RPC_RRDB_RRDB_REMOVE) { int err = 0; if (request.task_code == dsn::apps::RPC_RRDB_RRDB_PUT) { - put_rpc rpc(write); - err = _impl->batch_put(ctx, rpc.request(), rpc.response()); + put = put_rpc(write); + err = _impl->batch_put(ctx, put.request(), put.response()); } if (request.task_code == dsn::apps::RPC_RRDB_RRDB_REMOVE) { - remove_rpc rpc(write); - err = _impl->batch_remove(ctx.decree, rpc.request(), rpc.response()); + remove = remove_rpc(write); + err = _impl->batch_remove(ctx.decree, remove.request(), remove.response()); } if (!err) { err = _impl->batch_commit(ctx.decree);