From 6b6d7ce9b9be97a8c25815ed10cfd83bb9184464 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 27 Jul 2017 12:32:47 -0600 Subject: [PATCH] sig_timedwait: Pending signal structure used after it has been releasd. From anonymous Bitbucket Issue 59. --- sched/signal/sig_timedwait.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sched/signal/sig_timedwait.c b/sched/signal/sig_timedwait.c index 40cf8b55e6a..7003572964e 100644 --- a/sched/signal/sig_timedwait.c +++ b/sched/signal/sig_timedwait.c @@ -234,14 +234,14 @@ int sigtimedwait(FAR const sigset_t *set, FAR struct siginfo *info, memcpy(info, &sigpend->info, sizeof(struct siginfo)); } + /* The return value is the number of the signal that awakened us */ + + ret = sigpend->info.si_signo; + /* Then dispose of the pending signal structure properly */ sig_releasependingsignal(sigpend); leave_critical_section(flags); - - /* The return value is the number of the signal that awakened us */ - - ret = sigpend->info.si_signo; } /* We will have to wait for a signal to be posted to this task. */