diff options
author | Tiago Cunha <tcunha@gmx.com> | 2009-07-31 20:33:49 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2009-07-31 20:33:49 +0000 |
commit | cccd072ed17a34c928411c231f6863a7aa769ce4 (patch) | |
tree | ff7ddafcc021a03d946e534250e2356d34bb9bf4 /paste.c | |
parent | 5f0e688b50dedb7802852da00408e8e80fa8a4be (diff) | |
download | rtmux-cccd072ed17a34c928411c231f6863a7aa769ce4.tar.gz rtmux-cccd072ed17a34c928411c231f6863a7aa769ce4.tar.bz2 rtmux-cccd072ed17a34c928411c231f6863a7aa769ce4.zip |
Sync OpenBSD patchset 208:
Don't leak when rollling buffers off when the paste buffer limit is reached.
Diffstat (limited to 'paste.c')
-rw-r--r-- | paste.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -1,4 +1,4 @@ -/* $Id: paste.c,v 1.7 2009-07-02 16:23:54 nicm Exp $ */ +/* $Id: paste.c,v 1.8 2009-07-31 20:33:49 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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); |