Grouped sessions were being leaked on destroy, correctly free them.

This commit is contained in:
nicm 2013-10-10 11:46:28 +00:00
parent 0538676aa3
commit d3830e622f
2 changed files with 5 additions and 3 deletions

View File

@ -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);
}
}
}

View File

@ -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);