summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/server-fn.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2013-10-10 11:46:30 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2013-10-10 11:46:30 +0000
commita529867715c34e402341b54ddaded04afc322762 (patch)
treed6a35adffd787a516411bf62571ff0c4c0c2ab95 /usr.bin/tmux/server-fn.c
parenta53009dc25919bd21139e0f479525a0ce452aadc (diff)
Grouped sessions were being leaked on destroy, correctly free them.
Diffstat (limited to 'usr.bin/tmux/server-fn.c')
-rw-r--r--usr.bin/tmux/server-fn.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/tmux/server-fn.c b/usr.bin/tmux/server-fn.c
index 17d41bcedf6..9b88f64830b 100644
--- a/usr.bin/tmux/server-fn.c
+++ b/usr.bin/tmux/server-fn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-fn.c,v 1.70 2013/07/05 14:52:33 nicm Exp $ */
+/* $OpenBSD: server-fn.c,v 1.71 2013/10/10 11:46:28 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -398,14 +398,15 @@ void
server_destroy_session_group(struct session *s)
{
struct session_group *sg;
+ struct session *s1;
if ((sg = session_group_find(s)) == NULL)
server_destroy_session(s);
else {
- TAILQ_FOREACH(s, &sg->sessions, gentry)
+ TAILQ_FOREACH_SAFE(s, &sg->sessions, gentry, s1) {
server_destroy_session(s);
- TAILQ_REMOVE(&session_groups, sg, entry);
- free(sg);
+ session_destroy(s);
+ }
}
}