summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/main.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@ugent.be>2017-09-07 17:34:49 +0200
committerdimitri staessens <dimitri.staessens@ugent.be>2017-09-07 17:40:55 +0200
commit121df4d95f760a62e26f85fdca043558d2585bb1 (patch)
treeac25301bd6a8554974c26f893f8ca8ef87576aca /src/ipcpd/normal/main.c
parentf01187436eb51f955db604ad5fd19bf1389fb544 (diff)
downloadouroboros-121df4d95f760a62e26f85fdca043558d2585bb1.tar.gz
ouroboros-121df4d95f760a62e26f85fdca043558d2585bb1.zip
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.
Diffstat (limited to 'src/ipcpd/normal/main.c')
-rw-r--r--src/ipcpd/normal/main.c9
1 files changed, 4 insertions, 5 deletions
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);