Module: sip-router
Branch: master
Commit: cb04eea7b4e2a382a0315529d38d2f4ec5a60d93
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=cb04eea…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Tue Aug 19 18:19:46 2014 +0200
tmx: mark pretran struct as linked when adding to a non-empty slot
- otherwise is not going to be unlinked properly, with high potential of
ending in an infinite loop
- reported by Juha Heinanen
---
modules/tmx/tmx_pretran.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/modules/tmx/tmx_pretran.c b/modules/tmx/tmx_pretran.c
index 653f64c..a9c6f2a 100644
--- a/modules/tmx/tmx_pretran.c
+++ b/modules/tmx/tmx_pretran.c
@@ -121,6 +121,7 @@ void tmx_pretran_link_safe(int slotid)
_tmx_proc_ptran->next = _tmx_ptran_table[slotid].plist;
_tmx_ptran_table[slotid].plist->prev = _tmx_proc_ptran;
_tmx_ptran_table[slotid].plist = _tmx_proc_ptran;
+ _tmx_proc_ptran->linked = 1;
return;
}
@@ -250,9 +251,7 @@ int tmx_check_pretran(sip_msg_t *msg)
}
if(dsize<256) dsize = 256;
- lock_get(&_tmx_ptran_table[slotid].lock);
- tmx_pretran_unlink_safe(slotid);
- lock_release(&_tmx_ptran_table[slotid].lock);
+ tmx_pretran_unlink();
if(dsize > _tmx_proc_ptran->dbuf.len) {
if(_tmx_proc_ptran->dbuf.s) shm_free(_tmx_proc_ptran->dbuf.s);