Browse Source

Bugfixing: Fixed segmentation fault when removing all callback-jobs from job list (#1321)

* bugfix - timer.c: SegFault(dereferencing NULL Pointer) when removing all Callbacks from list -> check for NULL pointer

* Wrap check into SLIST_FIRST
FlorianPalm 7 years ago
parent
commit
00dcc1e170
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/ua_timer.c

+ 4 - 1
src/ua_timer.c

@@ -337,7 +337,10 @@ UA_Timer_process(UA_Timer *t, UA_DateTime nowMonotonic,
     processChanges(t);
 
     /* Return timestamp of next repetition */
-    return SLIST_FIRST(&t->repeatedCallbacks)->nextTime;
+    tc = SLIST_FIRST(&t->repeatedCallbacks);
+    if(!tc)
+        return UA_INT64_MAX; /* Main-loop has a max timeout / will continue earlier */
+    return tc->nextTime;
 }
 
 void