[sr-dev] git:master:a0552144: pike: init head list and safety check

Daniel-Constantin Mierla miconda at gmail.com
Tue Jan 29 14:25:27 CET 2019


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-01-29T14:24:34+01:00

pike: init head list and safety check

- related to GH #1822

---

Modified: src/modules/pike/pike_funcs.c

---

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

---

diff --git a/src/modules/pike/pike_funcs.c b/src/modules/pike/pike_funcs.c
index 6567ed59ef..2405090680 100644
--- a/src/modules/pike/pike_funcs.c
+++ b/src/modules/pike/pike_funcs.c
@@ -178,6 +178,7 @@ void clean_routine(unsigned int ticks , void *param)
 	 * be at least one element removed */
 	if (timer==0 || is_list_empty( timer )) return; /* quick exit */
 
+	memset(&head, 0, sizeof(struct list_link));
 	/* get the expired elements */
 	lock_get( timer_lock );
 	/* check again for empty list */
@@ -201,7 +202,7 @@ void clean_routine(unsigned int ticks , void *param)
 			continue;
 
 		lock_tree_branch( i );
-		for( ll=head.next ; ll!=&head ; ) {
+		for( ll=head.next; ll!=&head && ll!=NULL; ) {
 			node = ll2ipnode( ll );
 			ll = ll->next;
 			/* skip nodes from a different branch */




More information about the sr-dev mailing list