summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
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
parenta53009dc25919bd21139e0f479525a0ce452aadc (diff)
Grouped sessions were being leaked on destroy, correctly free them.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/server-fn.c9
-rw-r--r--usr.bin/tmux/session.c3
2 files changed, 7 insertions, 5 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);
+ }
}
}
diff --git a/usr.bin/tmux/session.c b/usr.bin/tmux/session.c
index 486505b8245..415c5424321 100644
--- a/usr.bin/tmux/session.c
+++ b/usr.bin/tmux/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.38 2013/03/25 10:11:45 nicm Exp $ */
+/* $OpenBSD: session.c,v 1.39 2013/10/10 11:46:29 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -151,6 +151,7 @@ void
session_destroy(struct session *s)
{
struct winlink *wl;
+
log_debug("session %s destroyed", s->name);
RB_REMOVE(sessions, &sessions, s);