summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2013-10-10 11:46:28 +0000
committernicm <nicm@openbsd.org>2013-10-10 11:46:28 +0000
commita8dbd3ace1b4d471b1a564a2b1bf747c5d0704d7 (patch)
tree998e5a7011d0d981b9b375a441aea945e3717677
parentMake recalculate_sizes() handle an empty window with no active (diff)
downloadwireguard-openbsd-a8dbd3ace1b4d471b1a564a2b1bf747c5d0704d7.tar.xz
wireguard-openbsd-a8dbd3ace1b4d471b1a564a2b1bf747c5d0704d7.zip
Grouped sessions were being leaked on destroy, correctly free them.
-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);