    if (!sched_verifytcb(htcb))
      {
        serr("ERROR: TCB 0x%08x is a stale handle, counts lost\n", htcb);
-+      DEBUGASSERT(!sched_verifytcb(htcb));
++      DEBUGASSERT(sched_verifytcb(htcb));
        sem_freeholder(sem, pholder);
      }
  

     {
       serr("ERROR: TCB 0x%08x is a stale handle, counts lost\n", htcb);
-      sem_freeholder(sem, pholder);
+      DEBUGASSERT(!sched_verifytcb(htcb));
+      pholder = sem_findholder(sem, htcb);
+      if (pholder != NULL)
+        {

 #endif
       return OK;
diff --git NuttX/nuttx/sched/semaphore/sem_holder.c NuttX/nuttx/sched/semaphore/sem_holder.c
index 6b9f05a..7b4e3e3 100644
--- NuttX/nuttx/sched/semaphore/sem_holder.c
+++ NuttX/nuttx/sched/semaphore/sem_holder.c
@@ -93,7 +93,7 @@ static inline FAR struct semholder_s *sem_allocholder(sem_t *sem)
