summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/server-client.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2012-03-17 18:24:08 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2012-03-17 18:24:08 +0000
commit68920a758325f7a7c215970f73e7978e42648041 (patch)
tree98ee7ef8c1b9643a1af1c2f41c36a32bc894c382 /usr.bin/tmux/server-client.c
parent900cf287b7ea95653f2f0865008aa6d932b76e3e (diff)
Check event_initialized before event_del if event may not have been set
up; libevent2 complains about this. Reported by Moriyoshi Koizumi.
Diffstat (limited to 'usr.bin/tmux/server-client.c')
-rw-r--r--usr.bin/tmux/server-client.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c
index ea8baa37c50..9dd835cda71 100644
--- a/usr.bin/tmux/server-client.c
+++ b/usr.bin/tmux/server-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-client.c,v 1.68 2012/03/09 21:42:13 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.69 2012/03/17 18:24:07 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -153,11 +153,13 @@ server_client_lost(struct client *c)
evtimer_del(&c->repeat_timer);
- evtimer_del(&c->identify_timer);
+ if (event_initialized(&c->identify_timer))
+ evtimer_del(&c->identify_timer);
if (c->message_string != NULL)
xfree(c->message_string);
- evtimer_del(&c->message_timer);
+ if (event_initialized (&c->message_timer))
+ evtimer_del(&c->message_timer);
for (i = 0; i < ARRAY_LENGTH(&c->message_log); i++) {
msg = &ARRAY_ITEM(&c->message_log, i);
xfree(msg->msg);
@@ -176,7 +178,8 @@ server_client_lost(struct client *c)
close(c->ibuf.fd);
imsg_clear(&c->ibuf);
- event_del(&c->event);
+ if (event_initialized(&c->event))
+ event_del(&c->event);
for (i = 0; i < ARRAY_LENGTH(&dead_clients); i++) {
if (ARRAY_ITEM(&dead_clients, i) == NULL) {