aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2018-06-22 15:57:47 +0300
committerEli Zaretskii2018-06-22 15:57:47 +0300
commitd6aa55e2b48d56bf9a2cd25176029b6fb80a80b2 (patch)
tree623d4c21c8ad7edf8d6ccdd034d7ede188b811e1
parentd22b8d1ad12c69a2c97bb9f4c9eb4316df13429e (diff)
downloademacs-d6aa55e2b48d56bf9a2cd25176029b6fb80a80b2.tar.gz
emacs-d6aa55e2b48d56bf9a2cd25176029b6fb80a80b2.zip
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)
-rw-r--r--src/editfns.c5
1 files changed, 3 insertions, 2 deletions
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. */)
3215 /* Since we didn’t define EARLY_ABORT, we should never abort 3215 /* Since we didn’t define EARLY_ABORT, we should never abort
3216 early. */ 3216 early. */
3217 eassert (! early_abort); 3217 eassert (! early_abort);
3218 SAFE_FREE ();
3219 3218
3220 Fundo_boundary (); 3219 Fundo_boundary ();
3221 ptrdiff_t count = SPECPDL_INDEX (); 3220 ptrdiff_t count = SPECPDL_INDEX ();
@@ -3261,8 +3260,10 @@ buffer stay intact. */)
3261 --i; 3260 --i;
3262 --j; 3261 --j;
3263 } 3262 }
3263 unbind_to (count, Qnil);
3264 SAFE_FREE ();
3264 3265
3265 return unbind_to (count, Qnil); 3266 return Qnil;
3266} 3267}
3267 3268
3268static void 3269static void