Message ID | 20181115060534.7146-5-blp@ovn.org |
---|---|
State | Accepted |
Headers | show |
Series | [ovs-dev,01/10] ovsdb-idl: Avoid sending transactions when the DB is not synced up. | expand |
diff --git a/ovsdb/raft.c b/ovsdb/raft.c index b682738a92f6..07884820ed9b 100644 --- a/ovsdb/raft.c +++ b/ovsdb/raft.c @@ -3045,8 +3045,10 @@ raft_update_match_index(struct raft *raft, struct raft_server *s, static void raft_update_our_match_index(struct raft *raft, uint64_t min_index) { - raft_update_match_index(raft, raft_find_server(raft, &raft->sid), - min_index); + struct raft_server *server = raft_find_server(raft, &raft->sid); + if (server) { + raft_update_match_index(raft, server, min_index); + } } static void
When the server is leaving the cluster but remains leader, the raft_find_server() call can return NULL. Previously this caused a null dereference. This commit fixes the problem. Signed-off-by: Ben Pfaff <blp@ovn.org> --- ovsdb/raft.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)