Do not leak command in formats, from Romain Francoise.

pull/1/head
Nicholas Marriott 2013-03-05 20:01:16 +00:00
parent f8c86a9515
commit f9e46a373f
1 changed files with 5 additions and 2 deletions

View File

@ -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 = osdep_get_cwd(wp->fd)) != NULL)
format_add(ft, "pane_current_path", "%s", cwd);
if ((cmd = osdep_get_name(wp->fd, wp->tty)) != NULL)
if ((cmd = osdep_get_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);