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)
committerMichael Adam <obnox@samba.org>
Thu, 12 Jan 2012 07:46:19 +0000 (08:46 +0100)
commit7b45aa95c8c98991897905109090449318eaaea6
treeda8e909bfd520ac19f9b79f4c4866c8034fd55cc
parentcbcf3b4983a63d52110e23cd97ffc8b612dc477c
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>
(cherry picked from commit 08f7f85477610a4916c1ec866aa467b28f1bbec3)
server/ctdb_takeover.c