]> git.eshelyaron.com Git - emacs.git/commitdiff
* bidi.c (bidi_cache_shrink): update size after realloc
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 19 Aug 2011 06:58:42 +0000 (23:58 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 19 Aug 2011 06:58:42 +0000 (23:58 -0700)
src/ChangeLog
src/bidi.c

index 36bf95e9aa75ad556b620cfa0245df16aba88a03..1db99549c60a1a83f1b3d598788bba711593f6f3 100644 (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,
index d8742540fc7471b21b39654f8ec2e9287b9816e3..769a14f089b446c2fa6291ed423d525da6e7a3cc 100644 (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 ();
 }