=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-load-buffer.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- src/usr.bin/tmux/cmd-load-buffer.c 2010/07/24 20:11:59 1.13 +++ src/usr.bin/tmux/cmd-load-buffer.c 2010/12/20 00:03:55 1.14 @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-load-buffer.c,v 1.13 2010/07/24 20:11:59 nicm Exp $ */ +/* $OpenBSD: cmd-load-buffer.c,v 1.14 2010/12/20 00:03:55 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha @@ -81,6 +81,7 @@ cdata = xmalloc(sizeof *cdata); cdata->session = s; + cdata->session->references++; cdata->buffer = data->buffer; c->stdin_data = cdata; c->stdin_callback = cmd_load_buffer_callback; @@ -144,7 +145,6 @@ char *pdata; size_t psize; u_int limit; - int idx; /* * Event callback has already checked client is not dead and reduced @@ -153,7 +153,7 @@ c->flags |= CLIENT_EXIT; /* Does the target session still exist? */ - if (session_index(s, &idx) != 0) + if (!session_alive(s)) goto out; psize = EVBUFFER_LENGTH(c->stdin_event->input); @@ -180,5 +180,6 @@ } out: + cdata->session->references--; xfree(cdata); }