Sync OpenBSD patchset 682:

If remain-on-exit is set, both the error callback and a SIGCHLD could
destroy the same pane (because the first one doesn't remove it from the
list of panes), causing the pane bufferevent to be freed twice. So don't
free it if the fd has already been set to -1, from Romain Francoise.
pull/1/head
Tiago Cunha 2010-04-18 15:10:55 +00:00
parent c0f03afbac
commit b03418fc6b
1 changed files with 6 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $Id: server-fn.c,v 1.104 2010-04-06 21:45:36 nicm Exp $ */
/* $Id: server-fn.c,v 1.105 2010-04-18 15:10:55 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -325,9 +325,11 @@ server_destroy_pane(struct window_pane *wp)
{
struct window *w = wp->window;
close(wp->fd);
bufferevent_free(wp->event);
wp->fd = -1;
if (wp->fd != -1) {
close(wp->fd);
bufferevent_free(wp->event);
wp->fd = -1;
}
if (options_get_number(&w->options, "remain-on-exit"))
return;