takeover: prevent crash by avoiding free in traverse on RST timeout
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 26 Jul 2010 04:28:48 +0000 (13:58 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 26 Jul 2010 04:28:48 +0000 (13:58 +0930)
commit2a5e4101f87f763cb55b8d1f4ab6a521abd1e41d
tree02b5115f4ebdbafc2b17238db613b7d5013c8dbd
parentc19b5fcd1689149e750ccc0a7ac1934045b46e1c
takeover: prevent crash by avoiding free in traverse on RST timeout

After 5 attempts to send a RST to a client without any response, we free
"con"; this is done during a traverse.  This frees the node we are walking
through (the node is made a child of "con" down in rb_tree.c's
trbt_create_node() (Valgrind would catch this, as Martin confirmed).

So, we create a temporary parent and reparent onto that; then we free
that parent after the traverse, thus deleting the unwanted nodes.

CQ:S1019041
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
server/ctdb_takeover.c