Commit d7821cf9 authored by Jan Kiszka's avatar Jan Kiszka Committed by Philippe Gerum

cobalt/posix/signal: Plug leak of pending signal struct on thread deletion

We need to free pending signals that have been allocated via
cobalt_signal_alloc() on thread destruction, or we will run out of them
quickly.
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent bc705c1e
......@@ -176,6 +176,7 @@ void cobalt_signal_flush(struct cobalt_thread *thread)
{
struct cobalt_sigpending *sigp, *tmp;
struct list_head *sigq;
spl_t s;
int n;
/*
......@@ -194,8 +195,15 @@ void cobalt_signal_flush(struct cobalt_thread *thread)
* detect this fact when deleting their respective
* owners.
*/
list_for_each_entry_safe(sigp, tmp, sigq, next)
list_for_each_entry_safe(sigp, tmp, sigq, next) {
list_del_init(&sigp->next);
if ((void *)sigp >= sigpending_mem &&
(void *)sigp < sigpending_mem + __SIGPOOL_SIZE) {
xnlock_get_irqsave(&nklock, s);
list_add_tail(&sigp->next, &sigpending_pool);
xnlock_put_irqrestore(&nklock, s);
}
}
}
sigemptyset(&thread->sigpending);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment