Module: xenomai-abe
Branch: analogy
Commit: 527ad0232f5b27d48335d89eb6f32aa760673c3e
URL:    
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=527ad0232f5b27d48335d89eb6f32aa760673c3e

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Mon Oct 19 21:24:32 2009 +0200

native: Release fastlock to the proper heap

Don't assume rt_task_delete is only called for in-kernel users, it may
be triggered via auto-cleanup also on user space objects. So check for
the creator and release the fastlock to the correct heap.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 ksrc/skins/native/mutex.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/ksrc/skins/native/mutex.c b/ksrc/skins/native/mutex.c
index 20eb484..6cf7eb1 100644
--- a/ksrc/skins/native/mutex.c
+++ b/ksrc/skins/native/mutex.c
@@ -47,6 +47,7 @@
 #include <nucleus/pod.h>
 #include <nucleus/registry.h>
 #include <nucleus/heap.h>
+#include <nucleus/sys_ppd.h>
 #include <native/task.h>
 #include <native/mutex.h>
 
@@ -316,8 +317,17 @@ int rt_mutex_delete(RT_MUTEX *mutex)
        err = rt_mutex_delete_inner(mutex);
 
 #ifdef CONFIG_XENO_FASTSYNCH
-       if (!err)
-               xnfree(mutex->synch_base.fastlock);
+       if (!err) {
+#ifdef CONFIG_XENO_OPT_PERVASIVE
+               if (mutex->cpid) {
+                       int global = xnsynch_test_flags(&mutex->synch_base,
+                                                       RT_MUTEX_EXPORTED);
+                       xnheap_free(&xnsys_ppd_get(global)->sem_heap,
+                                   mutex->synch_base.fastlock);
+               } else
+#endif /* CONFIG_XENO_OPT_PERVASIVE */
+                       xnfree(mutex->synch_base.fastlock);
+       }
 #endif /* CONFIG_XENO_FASTSYNCH */
 
        return err;


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to