From 121df4d95f760a62e26f85fdca043558d2585bb1 Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Thu, 7 Sep 2017 17:34:49 +0200 Subject: ipcpd: Fix double finalization after some failures When enroll or bootstrap failed, finalize_components could be called twice, resulting in double frees or use-after-free. --- src/ipcpd/normal/main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/ipcpd/normal') diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c index bc135c31..22b6e718 100644 --- a/src/ipcpd/normal/main.c +++ b/src/ipcpd/normal/main.c @@ -142,10 +142,6 @@ static void finalize_components(void) free(ipcpi.dif_name); - enroll_fini(); - - connmgr_fini(); - rib_fini(); } @@ -397,9 +393,12 @@ int main(int argc, if (ipcp_get_state() == IPCP_SHUTDOWN) { dt_stop(); stop_components(); + finalize_components(); } - finalize_components(); + enroll_fini(); + + connmgr_fini(); irm_unbind_api(getpid(), ipcpi.name); -- cgit v1.2.3