J Raynor
2015-02-23 04:54:38 UTC
There's a bug in window_copy_append_selection that causes tmux to free
memory that shouldn't be freed.
To reproduce the problem:
* Set mode-keys to vi so you can use A to append to a buffer
* Enter copy mode and copy some text
* Use lsb to note that the buffer names look normal
* Enter copy mode again, select some text, and hit A
* Use lsb again, and you should see the top buffer's name has been truncated
The problem is this line:
bufname = pb->name
Later in the function, paste_set is called, passing in bufname.
Eventually, this gets to paste_free_name, which frees the bufname,
paste_set then tries to create a new pb with the name that was passed
in, but that memory was just freed.
I've attached a patch that will fix this.
memory that shouldn't be freed.
To reproduce the problem:
* Set mode-keys to vi so you can use A to append to a buffer
* Enter copy mode and copy some text
* Use lsb to note that the buffer names look normal
* Enter copy mode again, select some text, and hit A
* Use lsb again, and you should see the top buffer's name has been truncated
The problem is this line:
bufname = pb->name
Later in the function, paste_set is called, passing in bufname.
Eventually, this gets to paste_free_name, which frees the bufname,
paste_set then tries to create a new pb with the name that was passed
in, but that memory was just freed.
I've attached a patch that will fix this.