Skip to content

Commit

Permalink
fix: cleanup order
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-burger committed Aug 26, 2024
1 parent f8056c5 commit 2176dbf
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1179,19 +1179,11 @@ int ec_open(ec_t *pec, struct hw_common *phw, int eeprom_log) {
int ec_close(ec_t *pec) {
assert(pec != NULL);

ec_log(10, "MASTER_CLOSE", "detroying tun device...\n");

#if LIBETHERCAT_MBX_SUPPORT_EOE == 1
ec_log(10, "MASTER_CLOSE", "detroying tun device...\n");
ec_eoe_destroy_tun(pec);
#endif

ec_log(10, "MASTER_CLOSE", "destroying async loop\n");
(void)ec_async_loop_destroy(&pec->async_loop);
ec_log(10, "MASTER_CLOSE", "closing hardware handle\n");
(void)hw_close(pec->phw);
ec_log(10, "MASTER_CLOSE", "freeing frame pool\n");
(void)pool_close(&pec->pool);

ec_log(10, "MASTER_CLOSE", "destroying pd_groups\n");
ec_index_deinit(&pec->idx_q);
(void)ec_destroy_pd_groups(pec);
Expand All @@ -1206,6 +1198,13 @@ int ec_close(ec_t *pec) {

pec->slave_cnt = 0;

ec_log(10, "MASTER_CLOSE", "destroying async loop\n");
(void)ec_async_loop_destroy(&pec->async_loop);
ec_log(10, "MASTER_CLOSE", "closing hardware handle\n");
(void)hw_close(pec->phw);
ec_log(10, "MASTER_CLOSE", "freeing frame pool\n");
(void)pool_close(&pec->pool);

(void)pool_close(&pec->mbx_message_pool_recv_free);
(void)pool_close(&pec->mbx_message_pool_send_free);

Expand Down

0 comments on commit 2176dbf

Please sign in to comment.