eventscript: fix callback after free
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 25 Jul 2011 08:26:06 +0000 (17:56 +0930)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Mon, 25 Jul 2011 09:07:53 +0000 (19:07 +1000)
commit976e968ea75db31c0b90c8de71536304e85c6521
tree61e6edfeb7387ea310b78f03186967ad33eb5b8d
parent489e1d68bd7b83605ce8c1e2a978234a70f99a08
eventscript: fix callback after free

ctdb_event_script_callback() takes a mem_ctx arg which it doesn't use, but
the implication is pretty clear, that when that mem_ctx is freed, the callback
shouldn't happen.  Indeed, Ronnie reproduced a case where that callback
refers to freed memory, in the ip reallocation code under stress.

So attach the callback to the mem_ctx they give us, and remove it from the
script state structure when that's freed.  It's a bit weird, but it works.

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