From: Jan Kiszka <jan.kiszka@domain.hid>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: Xenomai-core@domain.hid
Subject: Re: [Xenomai-core] [PATCH] Fix tiny memory leaks around rt_task_self()
Date: Fri, 11 Apr 2008 16:06:07 +0200 [thread overview]
Message-ID: <47FF704F.8040708@domain.hid> (raw)
In-Reply-To: <18431.26441.771360.551180@domain.hid>
Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
> > Nothing critical, but when using rt_task_self != NULL as a hint if the
> > caller is Xenomai-mapped or not, this stall malloc can become at least
> > unpleasant. This is also material for stable.
>
> This looks useless: TSD cleanup routines are automatically called
> upon thread termination. It is even worse: you risk a double free if you
> do not re-set pthread_setspecific after having called free.
Ah, I missed the already existing cleanup in init.c. Then we are done
with this patch:
Index: xenomai/ChangeLog
===================================================================
--- xenomai/ChangeLog (Revision 3698)
+++ xenomai/ChangeLog (Arbeitskopie)
@@ -1,3 +1,8 @@
+2008-04-11 Jan Kiszka <jan.kiszka@domain.hid>
+
+ * src/skins/native/task.c (rt_task_self): Fix tiny memory leak
+ when being invoked over a non-Xenomai thread.
+
2008-04-10 Philippe Gerum <rpm@xenomai.org>
* src/skins/*: Force minimum stack size to 32k, in order to work
Index: xenomai/src/skins/native/task.c
===================================================================
--- xenomai/src/skins/native/task.c (Revision 3698)
+++ xenomai/src/skins/native/task.c (Arbeitskopie)
@@ -294,8 +294,10 @@ RT_TASK *rt_task_self(void)
self = (RT_TASK *)malloc(sizeof(*self));
if (!self ||
- XENOMAI_SKINCALL1(__native_muxid, __native_task_self, self) != 0)
+ XENOMAI_SKINCALL1(__native_muxid, __native_task_self, self) != 0) {
+ free(self);
return NULL;
+ }
pthread_setspecific(__native_tskey, self);
prev parent reply other threads:[~2008-04-11 14:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-11 12:51 [Xenomai-core] [PATCH] Fix tiny memory leaks around rt_task_self() Jan Kiszka
2008-04-11 13:27 ` Gilles Chanteperdrix
2008-04-11 14:06 ` Jan Kiszka [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47FF704F.8040708@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=Xenomai-core@domain.hid \
--cc=gilles.chanteperdrix@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.