diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-11-12 16:39:30 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-11-12 16:39:30 +0000 |
commit | 765a224b3007c4ef617f22091db4c152de15dd86 (patch) | |
tree | 2856050d4d9a89f134b9e670e640dff446f5b0f8 | |
parent | 577bd45719f4a51057228eabd4c5e7ce5433cc44 (diff) | |
download | rtmux-765a224b3007c4ef617f22091db4c152de15dd86.tar.gz rtmux-765a224b3007c4ef617f22091db4c152de15dd86.tar.bz2 rtmux-765a224b3007c4ef617f22091db4c152de15dd86.zip |
Double-free on session destroy.
-rw-r--r-- | TODO | 4 | ||||
-rw-r--r-- | session.c | 12 |
2 files changed, 6 insertions, 10 deletions
@@ -22,8 +22,8 @@ - client could pass term/tty fd up to server and then do nothing. what problems would this cause? -- need access to all terminfo data at once... signals? - cleanup/redesign IPC - IPC is arse-about-face: too much overhead. 8-byte header for each - packet... hrm. already scanning output for \e, could add an extra + IPC is slightly arse-about-face: too much overhead. 8-byte header for + each packet... hrm. already scanning output for \e, could add an extra byte to it for message - could use bsearch all over the place or get rid of smaller tables (clientmsg) - better errors when creating new windows/sessions (how?) @@ -1,4 +1,4 @@ -/* $Id: session.c,v 1.28 2007-10-31 14:26:26 nicm Exp $ */ +/* $Id: session.c,v 1.29 2007-11-12 16:39:30 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -124,8 +124,7 @@ session_create(const char *name, const char *cmd, u_int sx, u_int sy) void session_destroy(struct session *s) { - struct winlink *wl; - u_int i; + u_int i; if (session_index(s, &i) != 0) fatalx("session not found"); @@ -133,11 +132,8 @@ session_destroy(struct session *s) while (!ARRAY_EMPTY(&sessions) && ARRAY_LAST(&sessions) == NULL) ARRAY_TRUNC(&sessions, 1); - while (!RB_EMPTY(&s->windows)) { - wl = RB_ROOT(&s->windows); - RB_REMOVE(winlinks, &s->windows, wl); - winlink_remove(&s->windows, wl); - } + while (!RB_EMPTY(&s->windows)) + winlink_remove(&s->windows, RB_ROOT(&s->windows)); xfree(s->name); xfree(s); |