From 5a5211006e937482b94e7b8547db15c8947f487a Mon Sep 17 00:00:00 2001 From: Sascha Kruse Date: Sat, 24 Sep 2011 00:45:14 +0200 Subject: [PATCH] fixed segfault thanks to chneukirchen --- dunst.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dunst.c b/dunst.c index c7589f1..f3b1a71 100644 --- a/dunst.c +++ b/dunst.c @@ -183,14 +183,20 @@ int list_len(msg_queue_t *list) { void check_timeouts(void) { - msg_queue_t *cur; + msg_queue_t *cur, *next; - for(cur = msgqueue; cur != NULL; cur = cur->next) { + cur = msgqueue; + while(cur != NULL) { if(cur->start == 0 || cur->timeout == 0) { + cur = cur->next; continue; } if(difftime(now, cur->start) > cur->timeout) { + next = cur->next; delete_msg(cur); + cur = next; + } else { + cur = cur->next; } } }