mirror of
https://github.com/tmate-io/tmate.git
synced 2026-07-22 10:37:25 +00:00
Don't leak when rollling buffers off when the paste buffer limit is reached.
This commit is contained in:
parent
97f105cde2
commit
95caeaa5dc
1 changed files with 5 additions and 1 deletions
6
paste.c
6
paste.c
|
|
@ -104,8 +104,12 @@ paste_add(struct paste_stack *ps, char *data, u_int limit)
|
|||
if (*data == '\0')
|
||||
return;
|
||||
|
||||
while (ARRAY_LENGTH(ps) >= limit)
|
||||
while (ARRAY_LENGTH(ps) >= limit) {
|
||||
pb = ARRAY_LAST(ps);
|
||||
xfree(pb->data);
|
||||
xfree(pb);
|
||||
ARRAY_TRUNC(ps, 1);
|
||||
}
|
||||
|
||||
pb = xmalloc(sizeof *pb);
|
||||
ARRAY_INSERT(ps, 0, pb);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue