Skip to content

Commit

Permalink
fix(asan): heap-use-after-free in pegasus_write_service.cpp (#478)
Browse files Browse the repository at this point in the history
  • Loading branch information
foreverneverer authored Feb 19, 2020
1 parent b8b0c8f commit 6b2a270
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/server/pegasus_write_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6b2a270

Please sign in to comment.