summaryrefslogtreecommitdiff
path: root/src/misc2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc2.c')
-rw-r--r--src/misc2.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/misc2.c b/src/misc2.c
index 4ed715b42..23b6090ce 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -1173,9 +1173,12 @@ free_all_mem(void)
#endif
for (buf = firstbuf; buf != NULL; )
{
+ bufref_T bufref;
+
+ set_bufref(&bufref, buf);
nextbuf = buf->b_next;
close_buffer(NULL, buf, DOBUF_WIPE, FALSE);
- if (buf_valid(buf))
+ if (bufref_valid(&bufref))
buf = nextbuf; /* didn't work, try next one */
else
buf = firstbuf;