Module: xenomai-2.6
Branch: master
Commit: 892c1bdc920f92696451f334ec4c7debeda8ebcf
URL:    
http://git.xenomai.org/?p=xenomai-2.6.git;a=commit;h=892c1bdc920f92696451f334ec4c7debeda8ebcf

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Sun Mar 10 21:14:22 2013 +0100

nucleus: check for NULL u_mode

---

 ksrc/nucleus/shadow.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c
index c91a6f3..ed3864b 100644
--- a/ksrc/nucleus/shadow.c
+++ b/ksrc/nucleus/shadow.c
@@ -1430,8 +1430,10 @@ void xnshadow_unmap(xnthread_t *thread)
        rpi_pop(thread);
 
        sys_ppd = xnsys_ppd_get(0);
-       xnheap_free(&sys_ppd->sem_heap, thread->u_mode);
-       thread->u_mode = NULL;
+       if (thread->u_mode) {
+               xnheap_free(&sys_ppd->sem_heap, thread->u_mode);
+               thread->u_mode = NULL;
+       }
 
        xnarch_atomic_dec(&sys_ppd->refcnt);
 
@@ -2379,7 +2381,7 @@ int do_hisyscall_event(unsigned event, 
rthal_pipeline_stage_t *stage,
       ret_handled:
 
        /* Update the userland-visible state. */
-       if (thread)
+       if (thread && thread->u_mode)
                *thread->u_mode = thread->state;
 
        trace_mark(xn_nucleus, syscall_histage_exit,
@@ -2549,7 +2551,7 @@ int do_losyscall_event(unsigned event, 
rthal_pipeline_stage_t *stage,
       ret_handled:
 
        /* Update the userland-visible state. */
-       if (thread)
+       if (thread && thread->u_mode)
                *thread->u_mode = thread->state;
 
        trace_mark(xn_nucleus, syscall_lostage_exit,


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to