[sr-dev] git:master:574b080d: core: slow timer - warning message if callback function is null

Daniel-Constantin Mierla miconda at gmail.com
Tue Nov 5 13:49:09 CET 2019


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-11-05T13:47:53+01:00

core: slow timer - warning message if callback function is null

---

Modified: src/core/timer.c

---

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

---

diff --git a/src/core/timer.c b/src/core/timer.c
index 1bcd036fda..f6b60ec3df 100644
--- a/src/core/timer.c
+++ b/src/core/timer.c
@@ -1101,7 +1101,19 @@ void slow_timer_main()
 #endif
 				SET_RUNNING_SLOW(tl);
 				UNLOCK_SLOW_TIMER_LIST();
-					ret=tl->f(*ticks, tl, tl->data);
+					if(likely(tl->f)) {
+						ret=tl->f(*ticks, tl, tl->data);
+					} else {
+						ret =0;
+#ifdef TIMER_DEBUG
+						LM_WARN("null timer callback for %p (%s:%u - %s(...))\n",
+								tl, (tl->add_file)?tl->add_file:"unknown",
+								tl->add_line,
+								(tl->add_func)?tl->add_func:"unknown");
+#else
+						LM_WARN("null callback function for %p\n", tl);
+#endif
+					}
 					/* reset the configuration group handles */
 					cfg_reset_all();
 					if (ret==0){




More information about the sr-dev mailing list