[sr-dev] git:master:cf26bbe3: tsilo: fix internal data structures

Vitaliy Aleksandrov vitalik.voip at gmail.com
Tue Nov 7 13:08:15 CET 2017


Module: kamailio
Branch: master
Commit: cf26bbe33307067141dc1abb21fb7c53cb0e5ecc
URL: https://github.com/kamailio/kamailio/commit/cf26bbe33307067141dc1abb21fb7c53cb0e5ecc

Author: Vitaliy Aleksandrov <vitalik.voip at gmail.com>
Committer: Vitaliy Aleksandrov <vitalik.voip at gmail.com>
Date: 2017-11-07T11:51:26+02:00

tsilo: fix internal data structures

- avoid crash by fixing "first" and "last" pointers of of the ts_entry_t after ts_urecord_t deletion

---

Modified: src/modules/tsilo/ts_hash.c

---

Diff:  https://github.com/kamailio/kamailio/commit/cf26bbe33307067141dc1abb21fb7c53cb0e5ecc.diff
Patch: https://github.com/kamailio/kamailio/commit/cf26bbe33307067141dc1abb21fb7c53cb0e5ecc.patch

---

diff --git a/src/modules/tsilo/ts_hash.c b/src/modules/tsilo/ts_hash.c
index 01d79940eb..fec10431ca 100644
--- a/src/modules/tsilo/ts_hash.c
+++ b/src/modules/tsilo/ts_hash.c
@@ -280,10 +280,10 @@ void remove_ts_urecord(ts_urecord_t* _r)
 	if (_r->next)
 		_r->next->prev = _r->prev;
 
-	/* it was the last urecord */
-	if (entry->n == 1) {
-                entry->first = entry->last = NULL;
-	}
+	if (entry->first == _r)
+		entry->first = _r->next;
+	if (entry->last == _r)
+		entry->last = _r->prev;
 
 	update_stat(stored_ruris, -1);
 




More information about the sr-dev mailing list