summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/main.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-08-25 15:54:02 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-08-25 16:16:32 +0200
commitf7777922edd673e43fd670d3d28f052fde2ecc0a (patch)
tree32443ecbb20927b33a6becd50dc6720e4be5b722 /src/ipcpd/normal/main.c
parent6da1fa9716e508d5d15d2953a2c358cfd24c1570 (diff)
downloadouroboros-f7777922edd673e43fd670d3d28f052fde2ecc0a.tar.gz
ouroboros-f7777922edd673e43fd670d3d28f052fde2ecc0a.zip
ipcpd, normal: Safe handling of CDAP requests
Destruction of the object in the reply stage was unsafe.
Diffstat (limited to 'src/ipcpd/normal/main.c')
-rw-r--r--src/ipcpd/normal/main.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c
index a067fb83..f0fc0681 100644
--- a/src/ipcpd/normal/main.c
+++ b/src/ipcpd/normal/main.c
@@ -80,15 +80,6 @@ void ipcp_sig_handler(int sig, siginfo_t * info, void * c)
ipcp_set_state(_ipcp, IPCP_SHUTDOWN);
pthread_rwlock_unlock(&_ipcp->state_lock);
-
- if (fmgr_fini())
- LOG_ERR("Failed to finalize flow manager.");
-
- if (ribmgr_fini())
- LOG_ERR("Failed to finalize RIB manager.");
-
- if (frct_fini())
- LOG_ERR("Failed to finalize FRCT.");
}
default:
return;
@@ -247,9 +238,9 @@ void normal_ipcp_data_destroy()
if (normal_data(_ipcp)->rb != NULL)
shm_ap_rbuff_close(normal_data(_ipcp)->rb);
- pthread_rwlock_unlock(&_ipcp->state_lock);
-
ipcp_data_destroy(_ipcp->data);
+
+ pthread_rwlock_unlock(&_ipcp->state_lock);
}
int main(int argc, char * argv[])
@@ -339,6 +330,15 @@ int main(int argc, char * argv[])
pthread_join(normal_data(_ipcp)->mainloop, NULL);
+ if (fmgr_fini())
+ LOG_ERR("Failed to finalize flow manager.");
+
+ if (ribmgr_fini())
+ LOG_ERR("Failed to finalize RIB manager.");
+
+ if (frct_fini())
+ LOG_ERR("Failed to finalize FRCT.");
+
normal_ipcp_data_destroy();
free(_ipcp);
close_logfile();