mirror of
https://github.com/tmate-io/tmate.git
synced 2024-11-07 16:54:01 +01:00
Fix memory leaks with paste_replace, based on changes from J Raynor.
This commit is contained in:
parent
69b7c496ac
commit
6daf06b1ad
@ -169,6 +169,7 @@ cmd_load_buffer_callback(struct client *c, int closed, void *data)
|
|||||||
/* No context so can't use server_client_msg_error. */
|
/* No context so can't use server_client_msg_error. */
|
||||||
evbuffer_add_printf(c->stderr_data, "no buffer %d\n", *buffer);
|
evbuffer_add_printf(c->stderr_data, "no buffer %d\n", *buffer);
|
||||||
server_push_stderr(c);
|
server_push_stderr(c);
|
||||||
|
free(pdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(data);
|
free(data);
|
||||||
|
4
paste.c
4
paste.c
@ -131,8 +131,10 @@ paste_replace(struct paste_stack *ps, u_int idx, char *data, size_t size)
|
|||||||
{
|
{
|
||||||
struct paste_buffer *pb;
|
struct paste_buffer *pb;
|
||||||
|
|
||||||
if (size == 0)
|
if (size == 0) {
|
||||||
|
free(data);
|
||||||
return (0);
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
if (idx >= ARRAY_LENGTH(ps))
|
if (idx >= ARRAY_LENGTH(ps))
|
||||||
return (-1);
|
return (-1);
|
||||||
|
@ -1455,8 +1455,8 @@ window_copy_copy_buffer(struct window_pane *wp, int idx, void *buf, size_t len)
|
|||||||
if (idx == -1) {
|
if (idx == -1) {
|
||||||
limit = options_get_number(&global_options, "buffer-limit");
|
limit = options_get_number(&global_options, "buffer-limit");
|
||||||
paste_add(&global_buffers, buf, len, limit);
|
paste_add(&global_buffers, buf, len, limit);
|
||||||
} else
|
} else if (paste_replace(&global_buffers, idx, buf, len) != 0)
|
||||||
paste_replace(&global_buffers, idx, buf, len);
|
free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user