Commit 51f30bc5 authored by Paul Eggert's avatar Paul Eggert
Browse files

* bidi.c (bidi_cache_shrink): update size after realloc

parent 81f7c12e
......@@ -59,6 +59,7 @@
(bidi_cache_ensure_space, bidi_shelve_cache): Use it.
(bidi_cache_ensure_space): Avoid integer overflow when allocating.
* bidi.c (bidi_cache_shrink):
* buffer.c (overlays_at, overlays_in, record_overlay_string)
(overlay_strings):
Don't update size of array until after memory allocation succeeds,
......
......@@ -350,9 +350,9 @@ bidi_cache_shrink (void)
{
if (bidi_cache_size > BIDI_CACHE_CHUNK)
{
bidi_cache_size = BIDI_CACHE_CHUNK;
bidi_cache =
(struct bidi_it *) xrealloc (bidi_cache, bidi_cache_size * elsz);
(struct bidi_it *) xrealloc (bidi_cache, BIDI_CACHE_CHUNK * elsz);
bidi_cache_size = BIDI_CACHE_CHUNK;
}
bidi_cache_reset ();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment