Call the freeCB function a manual timer stop call 75/19475/1
authorRomain Forlot <romain.forlot@iot.bzh>
Fri, 4 Jan 2019 13:25:55 +0000 (14:25 +0100)
committerRomain Forlot <romain.forlot@iot.bzh>
Fri, 4 Jan 2019 13:37:24 +0000 (14:37 +0100)
This invokes the freeCB callback function which is in charge of release allocated
resources in the timer callback. This was only called on a normal stop of a timer
not when called manually by TimerEvtStop.

Change-Id: I750a62ee0662b905107f53d070add1e8ccba77f8
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
afb-timer.c

index b302278..4afdb0e 100644 (file)
@@ -61,8 +61,8 @@ static int TimerNext (sd_event_source* source, uint64_t timer, void* handle) {
 }
 
 void TimerEvtStop(TimerHandleT *timerHandle) {
-
     sd_event_source_unref(timerHandle->evtSource);
+    if (timerHandle->freeCB) timerHandle->freeCB(timerHandle->context);
     free (timerHandle);
 }