On Sun, Mar 24, 2019 at 06:54:15AM +0100, Neels Hofmeyr wrote:
So far I am talloc_steal()ing FSM instances
"freed" in osmo_fsm_inst_term()
cascades to the first/outermost osmo_fsm_inst_term() fi as talloc parent, so
that all get freed once in the end.
Interesting to note here is that I can apparently steal a talloc parent to
become a talloc child (this is the result of the child osmo_fsm_inst_term()
also causing the parent to term)
parent_fi
|
+- child_fi
talloc_steal(new_ctx=child_fi, parent_fi)
I guess this should result in:
child_fi
|
+- parent_fi
I'm not entirely clear how this works out. Are those then still attached to
whatever parent_fi had as a parent context? Are they floating alone?
The test shows that it does work, no leaks, no loops.
Since child_fi is guaranteed to be deallocated, either way would be fine. If
this is bugging us we can use a different talloc_ctx to steal into -- I just
wanted to avoid allocating another short-lived ctx.
~N