summaryrefslogtreecommitdiff
path: root/ovsdb/raft.c
diff options
context:
space:
mode:
authorIlya Maximets <i.maximets@ovn.org>2020-05-04 21:55:41 +0200
committerWilliam Tu <u9012063@gmail.com>2020-05-04 18:07:08 -0700
commit48b1c7642e2a046a255532b5f2322e70e352d790 (patch)
tree407afabf476e372f205bfe8bc15305602a497b48 /ovsdb/raft.c
parent5119cfe32d021300663809eb23be6b33cbd4073a (diff)
downloadopenvswitch-48b1c7642e2a046a255532b5f2322e70e352d790.tar.gz
raft: Fix leak of the incomplete command.
Function raft_command_initiate() returns correctly referenced command instance. 'n_ref' equals 1 for complete commands and 2 for incomplete commands because one more reference is in raft->commands list. raft_handle_execute_command_request__() leaks the reference by not returning pointer anywhere and not unreferencing incomplete commands. 792 bytes in 11 blocks are definitely lost in loss record 258 of 262 at 0x483BB1A: calloc (vg_replace_malloc.c:762) by 0x44BA32: xcalloc (util.c:121) by 0x422E5F: raft_command_create_incomplete (raft.c:2038) by 0x422E5F: raft_command_initiate (raft.c:2061) by 0x428651: raft_handle_execute_command_request__ (raft.c:4161) by 0x428651: raft_handle_execute_command_request (raft.c:4177) by 0x428651: raft_handle_rpc (raft.c:4230) by 0x428651: raft_conn_run (raft.c:1445) by 0x428DEA: raft_run (raft.c:1803) by 0x407392: main_loop (ovsdb-server.c:226) by 0x407392: main (ovsdb-server.c:469) Fixes: 1b1d2e6daa56 ("ovsdb: Introduce experimental support for clustered databases.") Signed-off-by: Ilya Maximets <i.maximets@ovn.org> Acked-by: Han Zhou <hzhou@ovn.org> Signed-off-by: William Tu <u9012063@gmail.com>
Diffstat (limited to 'ovsdb/raft.c')
-rw-r--r--ovsdb/raft.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/ovsdb/raft.c b/ovsdb/raft.c
index 6391eeb13..e0af6bd62 100644
--- a/ovsdb/raft.c
+++ b/ovsdb/raft.c
@@ -4163,9 +4163,7 @@ raft_handle_execute_command_request__(
cmd->sid = rq->common.sid;
enum raft_command_status status = cmd->status;
- if (status != RAFT_CMD_INCOMPLETE) {
- raft_command_unref(cmd);
- }
+ raft_command_unref(cmd);
return status;
}