Skip to content

Commit

Permalink
os_tmr.c - prevent tmr corruption on double-create
Browse files Browse the repository at this point in the history
Fixed corruption of timer state when attempting to re-create an existing timer with OBJ_CREATED_CHK enabled.
  • Loading branch information
forg0ne committed Apr 30, 2021
1 parent 4dc0492 commit f4fad0c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Source/os_tmr.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ void OSTmrCreate (OS_TMR *p_tmr,
OS_TmrLock();
}

p_tmr->State = OS_TMR_STATE_STOPPED; /* Initialize the timer fields */
#if (OS_OBJ_TYPE_REQ > 0u)
#if (OS_CFG_OBJ_CREATED_CHK_EN > 0u)
if (p_tmr->Type == OS_OBJ_TYPE_TMR) {
Expand All @@ -177,6 +176,8 @@ void OSTmrCreate (OS_TMR *p_tmr,
#endif
p_tmr->Type = OS_OBJ_TYPE_TMR;
#endif

p_tmr->State = OS_TMR_STATE_STOPPED; /* Initialize the timer fields */
#if (OS_CFG_DBG_EN > 0u)
p_tmr->NamePtr = p_name;
#else
Expand Down

0 comments on commit f4fad0c

Please sign in to comment.