From: Eli Zaretskii Date: Fri, 22 Jun 2018 12:57:47 +0000 (+0300) Subject: Avoid segfaults in replace-buffer-contents with large buffers X-Git-Tag: emacs-26.1.90~338 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d6aa55e;p=emacs.git Avoid segfaults in replace-buffer-contents with large buffers * src/editfns.c (Freplace_buffer_contents): Don't release malloc'ed memory as long as we are using it. (Bug#31888) --- diff --git a/src/editfns.c b/src/editfns.c index fc5b6c117f5..d15ae59029d 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -3215,7 +3215,6 @@ buffer stay intact. */) /* Since we didn’t define EARLY_ABORT, we should never abort early. */ eassert (! early_abort); - SAFE_FREE (); Fundo_boundary (); ptrdiff_t count = SPECPDL_INDEX (); @@ -3261,8 +3260,10 @@ buffer stay intact. */) --i; --j; } + unbind_to (count, Qnil); + SAFE_FREE (); - return unbind_to (count, Qnil); + return Qnil; } static void