aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--paste.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/paste.c b/paste.c
index 981385e9..82fa0939 100644
--- a/paste.c
+++ b/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);