Module: kamailio Branch: master Commit: 5192e5d275761ccd1af49d4bf9dd12e1438947b7 URL: https://github.com/kamailio/kamailio/commit/5192e5d275761ccd1af49d4bf9dd12e1...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2023-12-24T12:20:57+01:00
tmx: rework cleaning up on init failure
---
Modified: src/modules/tmx/tmx_pretran.c
---
Diff: https://github.com/kamailio/kamailio/commit/5192e5d275761ccd1af49d4bf9dd12e1... Patch: https://github.com/kamailio/kamailio/commit/5192e5d275761ccd1af49d4bf9dd12e1...
---
diff --git a/src/modules/tmx/tmx_pretran.c b/src/modules/tmx/tmx_pretran.c index 7600a3c7b4b..a7c7d52df87 100644 --- a/src/modules/tmx/tmx_pretran.c +++ b/src/modules/tmx/tmx_pretran.c @@ -103,10 +103,11 @@ int tmx_init_pretran_table(void) for(n = 0; n < _tmx_ptran_size; n++) { if(lock_init(&_tmx_ptran_table[n].lock) == NULL) { LM_ERR("cannot init the lock %d\n", n); - n--; - while(n >= 0) { - lock_destroy(&_tmx_ptran_table[n].lock); - n--; + if(n > 0) { + do { + n--; + lock_destroy(&_tmx_ptran_table[n].lock); + } while(n > 0); } shm_free(_tmx_ptran_table); _tmx_ptran_table = 0;