From 23d3161d4bbe80da13bf3e7afb64242dc8b7236c Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Tue, 16 Jan 2018 18:50:23 +0100 Subject: fsm: fix double llist_del in osmo_fsm_inst_term() llist_del(&fi->proc.child) is executed always, regardless whether a parent is configured or not. This may lead into a double llist_del when the child has been previously unlinked. - check if fi->proc.parent is set, and only then execute llist_del(&fi->proc.child); Change-Id: I4b33d508c8a11b72fbf30125088a882894d9e6ac --- src/fsm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/fsm.c b/src/fsm.c index 0bdcd9d4..f9effc47 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -483,10 +483,11 @@ void _osmo_fsm_inst_term(struct osmo_fsm_inst *fi, /* delete ourselves from the parent */ parent = fi->proc.parent; - if (parent) + if (parent) { LOGPFSMSRC(fi, file, line, "Removing from parent %s\n", osmo_fsm_inst_name(parent)); - llist_del(&fi->proc.child); + llist_del(&fi->proc.child); + } /* call destructor / clean-up function */ if (fi->fsm->cleanup) -- cgit v1.2.3