From f7777922edd673e43fd670d3d28f052fde2ecc0a Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Thu, 25 Aug 2016 15:54:02 +0200 Subject: ipcpd, normal: Safe handling of CDAP requests Destruction of the object in the reply stage was unsafe. --- src/ipcpd/normal/main.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/ipcpd/normal/main.c') 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(); -- cgit v1.2.3