summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEamon Walsh <ewalsh@tycho.nsa.gov>2011-03-03 13:58:38 -0500
committerEamon Walsh <ewalsh@tycho.nsa.gov>2011-03-03 13:58:38 -0500
commitf3071adcd823fc1919d496dc7d8f7f2969f916bd (patch)
tree57b6fb803a2f0ab32a27b2a4084588c01e3cbffa
parent9dd23aa6f5d3b3a66d7c2a9ac7b5c59c4068a423 (diff)
Fix use-after-free during program exit.
-rw-r--r--src/client.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/client.c b/src/client.c
index 226fd87..c50f9b8 100644
--- a/src/client.c
+++ b/src/client.c
@@ -88,8 +88,6 @@ client_remove(struct client *c)
void
client_remove_all(void)
{
- struct client *c;
-
- LIST_FOREACH(c, &clients, next)
- client_remove(c);
+ while (!LIST_EMPTY(&clients))
+ client_remove(LIST_FIRST(&clients));
}