Browse code

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

Jason Penton authored on 12/11/2014 14:34:57
Showing 1 changed files
... ...
@@ -243,7 +243,7 @@ void mem_delete_pcontact(udomain_t* _d, struct pcontact* _c)
243 243
 
244 244
 void mem_timer_udomain(udomain_t* _d)
245 245
 {
246
-	struct pcontact* ptr;
246
+	struct pcontact* ptr, *tmp;
247 247
 	int i;
248 248
 
249 249
 	for(i=0; i<_d->size; i++)
... ...
@@ -253,17 +253,11 @@ void mem_timer_udomain(udomain_t* _d)
253 253
 		ptr = _d->table[i].first;
254 254
 
255 255
 		while(ptr) {
256
-			timer_pcontact(ptr);
257
-			/* Remove the entire record if it is empty */
258
-			//if (ptr->contacts == 0) {
259
-			//	t = ptr;
260
-			//	ptr = ptr->next;
261
-			//	mem_delete_pcontact(_d, t);
262
-			//}//// else {
263
-			//	ptr = ptr->next;
264
-			//}
265
-			ptr = ptr->next;
256
+		    tmp = ptr;
257
+		    ptr = ptr->next;
258
+		    timer_pcontact(tmp);
266 259
 		}
260
+		
267 261
 		unlock_ulslot(_d, i);
268 262
 	}
269 263
 }