[sr-dev] git:master: modules/ims_usrloc_pcscf: Fixed bug deleting memory within loop on timer checking expired contacts

Jason Penton jason.penton at gmail.com
Wed Nov 12 15:35:17 CET 2014


Module: sip-router
Branch: master
Commit: e3c7ff83da1a72ef53e45e6263b6b9ce72312063
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=e3c7ff83da1a72ef53e45e6263b6b9ce72312063

Author: Jason Penton <jason.penton at gmail.com>
Committer: Jason Penton <jason.penton at gmail.com>
Date:   Wed Nov 12 16:34:57 2014 +0200

modules/ims_usrloc_pcscf: Fixed bug deleting memory within loop on timer checking expired contacts

---

 modules/ims_usrloc_pcscf/udomain.c |   16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/modules/ims_usrloc_pcscf/udomain.c b/modules/ims_usrloc_pcscf/udomain.c
index 740a242..fcbdb6c 100644
--- a/modules/ims_usrloc_pcscf/udomain.c
+++ b/modules/ims_usrloc_pcscf/udomain.c
@@ -243,7 +243,7 @@ void mem_delete_pcontact(udomain_t* _d, struct pcontact* _c)
 
 void mem_timer_udomain(udomain_t* _d)
 {
-	struct pcontact* ptr;
+	struct pcontact* ptr, *tmp;
 	int i;
 
 	for(i=0; i<_d->size; i++)
@@ -253,17 +253,11 @@ void mem_timer_udomain(udomain_t* _d)
 		ptr = _d->table[i].first;
 
 		while(ptr) {
-			timer_pcontact(ptr);
-			/* Remove the entire record if it is empty */
-			//if (ptr->contacts == 0) {
-			//	t = ptr;
-			//	ptr = ptr->next;
-			//	mem_delete_pcontact(_d, t);
-			//}//// else {
-			//	ptr = ptr->next;
-			//}
-			ptr = ptr->next;
+		    tmp = ptr;
+		    ptr = ptr->next;
+		    timer_pcontact(tmp);
 		}
+		
 		unlock_ulslot(_d, i);
 	}
 }




More information about the sr-dev mailing list