diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-07-30 20:50:54 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-07-30 20:50:54 +0000 |
commit | 95caeaa5dc7f326a53559ea86792e488d88e2c66 (patch) | |
tree | ccdb7a5e9e61844b97bdaa4e0c5b22532b816e84 | |
parent | 97f105cde22c50ecf3cc1edd68df2664f3645bcc (diff) |
Don't leak when rollling buffers off when the paste buffer limit is reached.
-rw-r--r-- | paste.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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); |