summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/csplit.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/csplit.c b/src/csplit.c
index 57543f0a2..948a795e2 100644
--- a/src/csplit.c
+++ b/src/csplit.c
@@ -418,6 +418,13 @@ get_new_buffer (size_t min_size)
static void
free_buffer (struct buffer_record *buf)
{
+ struct line *l;
+ for (l = buf->line_start; l;)
+ {
+ struct line *n = l->next;
+ free (l);
+ l = n;
+ }
free (buf->buffer);
buf->buffer = NULL;
}
@@ -542,6 +549,7 @@ remove_line (void)
if (prev_buf)
{
free_buffer (prev_buf);
+ free (prev_buf);
prev_buf = NULL;
}