mirror of
https://github.com/tmux/tmux.git
synced 2026-02-16 11:10:16 +00:00
Make paste_get_top return a copy of the buffer name which is more
sensible and avoids a double free pointed out by DongHan Kim.
This commit is contained in:
4
paste.c
4
paste.c
@@ -107,7 +107,7 @@ paste_is_empty(void)
|
||||
|
||||
/* Get the most recent automatic buffer. */
|
||||
struct paste_buffer *
|
||||
paste_get_top(const char **name)
|
||||
paste_get_top(char **name)
|
||||
{
|
||||
struct paste_buffer *pb;
|
||||
|
||||
@@ -117,7 +117,7 @@ paste_get_top(const char **name)
|
||||
if (pb == NULL)
|
||||
return (NULL);
|
||||
if (name != NULL)
|
||||
*name = pb->name;
|
||||
*name = xstrdup(pb->name);
|
||||
return (pb);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user