diff options
| author | Eli Zaretskii | 2018-06-22 15:57:47 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2018-06-22 15:57:47 +0300 |
| commit | d6aa55e2b48d56bf9a2cd25176029b6fb80a80b2 (patch) | |
| tree | 623d4c21c8ad7edf8d6ccdd034d7ede188b811e1 /src | |
| parent | d22b8d1ad12c69a2c97bb9f4c9eb4316df13429e (diff) | |
| download | emacs-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)
Diffstat (limited to 'src')
| -rw-r--r-- | src/editfns.c | 5 |
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 | ||
| 3268 | static void | 3269 | static void |