summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2016-08-25 09:33:15 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2016-08-25 09:33:15 +0000
commitb5a02401c91bd5e7a1374e3ff0dd196e7ab9ae66 (patch)
tree7dccdcf86795a213fc96717bece883aa59fc6eee /usr.bin
parentcd255ca86a44629104405591ca33dddac8e343c1 (diff)
Do not crash if display-message used without a client, issue reported by
Serge Aleynikov, fix from Thomas Adam.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/cmd-display-message.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/tmux/cmd-display-message.c b/usr.bin/tmux/cmd-display-message.c
index f0a031721a2..4507b15a5e6 100644
--- a/usr.bin/tmux/cmd-display-message.c
+++ b/usr.bin/tmux/cmd-display-message.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-display-message.c,v 1.35 2015/12/14 00:31:54 nicm Exp $ */
+/* $OpenBSD: cmd-display-message.c,v 1.36 2016/08/25 09:33:14 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -78,9 +78,10 @@ cmd_display_message_exec(struct cmd *self, struct cmd_q *cmdq)
msg = format_expand_time(ft, template, time(NULL));
if (args_has(self->args, 'p'))
cmdq_print(cmdq, "%s", msg);
- else
+ else if (c != NULL)
status_message_set(c, "%s", msg);
free(msg);
+
format_free(ft);
return (CMD_RETURN_NORMAL);