summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2013-03-25 10:07:22 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2013-03-25 10:07:22 +0000
commitd93299c737ff4e5045b491bf4173316bfde8634a (patch)
tree82582d3006b5cffadfcd41754cbf94f86b6f3c2a /usr.bin
parentd4494b8cc7bb21bba676fcd6c41260b1fc4058e7 (diff)
Do not leak command in formats, from Romain Francoise.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/format.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c
index fc1d1853751..9fbfe85296f 100644
--- a/usr.bin/tmux/format.c
+++ b/usr.bin/tmux/format.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: format.c,v 1.20 2013/03/24 09:54:10 nicm Exp $ */
+/* $OpenBSD: format.c,v 1.21 2013/03/25 10:07:21 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -398,7 +398,8 @@ format_window_pane(struct format_tree *ft, struct window_pane *wp)
struct grid_line *gl;
unsigned long long size;
u_int i, idx;
- const char *cwd, *cmd;
+ const char *cwd;
+ char *cmd;
size = 0;
for (i = 0; i < gd->hsize; i++) {
@@ -432,8 +433,10 @@ format_window_pane(struct format_tree *ft, struct window_pane *wp)
format_add(ft, "pane_start_path", "%s", wp->cwd);
if ((cwd = get_proc_cwd(wp->fd)) != NULL)
format_add(ft, "pane_current_path", "%s", cwd);
- if ((cmd = get_proc_name(wp->fd, wp->tty)) != NULL)
+ if ((cmd = get_proc_name(wp->fd, wp->tty)) != NULL) {
format_add(ft, "pane_current_command", "%s", cmd);
+ free(cmd);
+ }
format_add(ft, "cursor_x", "%d", wp->base.cx);
format_add(ft, "cursor_y", "%d", wp->base.cy);