1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-10 05:30:45 -08:00

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

This commit is contained in:
Paul Eggert 2011-08-18 23:58:42 -07:00
parent 81f7c12e80
commit 51f30bc52d
2 changed files with 3 additions and 2 deletions

View file

@ -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,

View file

@ -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 ();
}