mirror of
https://github.com/tmux/tmux.git
synced 2024-12-14 10:58:48 +00:00
Do not leak command in formats, from Romain Francoise.
This commit is contained in:
parent
ebd9c615c8
commit
35452b3e55
7
format.c
7
format.c
@ -398,7 +398,8 @@ format_window_pane(struct format_tree *ft, struct window_pane *wp)
|
|||||||
struct grid_line *gl;
|
struct grid_line *gl;
|
||||||
unsigned long long size;
|
unsigned long long size;
|
||||||
u_int i, idx;
|
u_int i, idx;
|
||||||
const char *cwd, *cmd;
|
const char *cwd;
|
||||||
|
char *cmd;
|
||||||
|
|
||||||
size = 0;
|
size = 0;
|
||||||
for (i = 0; i < gd->hsize; i++) {
|
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);
|
format_add(ft, "pane_start_path", "%s", wp->cwd);
|
||||||
if ((cwd = get_proc_cwd(wp->fd)) != NULL)
|
if ((cwd = get_proc_cwd(wp->fd)) != NULL)
|
||||||
format_add(ft, "pane_current_path", "%s", cwd);
|
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);
|
format_add(ft, "pane_current_command", "%s", cmd);
|
||||||
|
free(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
format_add(ft, "cursor_x", "%d", wp->base.cx);
|
format_add(ft, "cursor_x", "%d", wp->base.cx);
|
||||||
format_add(ft, "cursor_y", "%d", wp->base.cy);
|
format_add(ft, "cursor_y", "%d", wp->base.cy);
|
||||||
|
Loading…
Reference in New Issue
Block a user