From: Paul Eggert Date: Fri, 19 Aug 2011 06:58:42 +0000 (-0700) Subject: * bidi.c (bidi_cache_shrink): update size after realloc X-Git-Tag: emacs-pretest-24.0.90~104^2~152^2~72 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=51f30bc52daf551f3c433b80f598eb52dca71033;p=emacs.git * bidi.c (bidi_cache_shrink): update size after realloc --- diff --git a/src/ChangeLog b/src/ChangeLog index 36bf95e9aa7..1db99549c60 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -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, diff --git a/src/bidi.c b/src/bidi.c index d8742540fc7..769a14f089b 100644 --- a/src/bidi.c +++ b/src/bidi.c @@ -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 (); }