From 9ba27b28a078bfa1e04af2a06b8b8f2fbd22c34e Mon Sep 17 00:00:00 2001 From: Jeremy Lakeman Date: Mon, 16 Apr 2018 09:36:17 +0930 Subject: [PATCH] Possible race condition in command cleanup due to linking order, (Fixes #136) --- keyring.c | 1 + overlay_address.c | 10 ---------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/keyring.c b/keyring.c index a116fe73..c14ac96b 100644 --- a/keyring.c +++ b/keyring.c @@ -2247,4 +2247,5 @@ static void keyring_on_cmd_cleanup() { keyring_free(keyring); keyring = NULL; + free_subscribers(); } diff --git a/overlay_address.c b/overlay_address.c index 22bd8289..a6db8c81 100644 --- a/overlay_address.c +++ b/overlay_address.c @@ -143,16 +143,6 @@ void free_subscribers() tree_walk(&root, NULL, 0, free_node, NULL); } -/* Free the subscribers tree after every CLI command. - */ - -static void subscriber_on_cmd_cleanup(); -DEFINE_TRIGGER(cmd_cleanup, subscriber_on_cmd_cleanup); -static void subscriber_on_cmd_cleanup() -{ - free_subscribers(); -} - static void *create_subscriber(void *UNUSED(context), const uint8_t *binary, size_t bin_length) { assert(bin_length == SID_SIZE);