summaryrefslogtreecommitdiff
path: root/usr.bin/mg
diff options
context:
space:
mode:
authorVincent Labrecque <vincent@cvs.openbsd.org>2002-03-05 20:31:11 +0000
committerVincent Labrecque <vincent@cvs.openbsd.org>2002-03-05 20:31:11 +0000
commit6e94b34c624573857eb76b85fbc868ab31d33b9d (patch)
tree4719301144dd418f87bebc7125cf8f7ca315f938 /usr.bin/mg
parent475601438edc519f3af2d970eafa7f0a4afa2733 (diff)
Fix a ridiculous bug I introduced in the buffer code. Free the undo records
list correctly.
Diffstat (limited to 'usr.bin/mg')
-rw-r--r--usr.bin/mg/buffer.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/mg/buffer.c b/usr.bin/mg/buffer.c
index fecc33fab11..8efa928b964 100644
--- a/usr.bin/mg/buffer.c
+++ b/usr.bin/mg/buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.c,v 1.24 2002/02/26 00:45:45 vincent Exp $ */
+/* $OpenBSD: buffer.c,v 1.25 2002/03/05 20:31:10 vincent Exp $ */
/*
* Buffer handling.
@@ -99,7 +99,7 @@ killbuffer(f, n)
MGWIN *wp;
int s;
char bufn[NBUFN];
- struct undo_rec *rec;
+ struct undo_rec *rec, *next;
if ((s = eread("Kill buffer: (default %s) ", bufn, NBUFN, EFNEW | EFBUF,
curbp->b_bname)) == ABORT)
@@ -158,10 +158,13 @@ killbuffer(f, n)
bp1->b_altb = (bp->b_altb == bp1) ? NULL : bp->b_altb;
bp1 = bp1->b_bufp;
}
- while ((rec = LIST_FIRST(&bp->b_undo)) != NULL) {
+ rec = LIST_FIRST(&bp->b_undo);
+ while (rec != NULL) {
+ next = LIST_NEXT(rec, next);
free_undo_record(rec);
- LIST_REMOVE(rec, next);
+ rec = next;
}
+
free(bp->b_bname); /* Release name block */
free(bp); /* Release buffer block */
return TRUE;