diff options
| author | Paul Eggert | 2011-08-18 23:58:42 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-08-18 23:58:42 -0700 |
| commit | 51f30bc52daf551f3c433b80f598eb52dca71033 (patch) | |
| tree | d6e6f694615a4d16f006e9e7e5dde2e9eb566a93 | |
| parent | 81f7c12e8079e2fa66cc14c34bb43260a15a190c (diff) | |
| download | emacs-51f30bc52daf551f3c433b80f598eb52dca71033.tar.gz emacs-51f30bc52daf551f3c433b80f598eb52dca71033.zip | |
* bidi.c (bidi_cache_shrink): update size after realloc
| -rw-r--r-- | src/ChangeLog | 1 | ||||
| -rw-r--r-- | src/bidi.c | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 36bf95e9aa7..1db99549c60 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -59,6 +59,7 @@ | |||
| 59 | (bidi_cache_ensure_space, bidi_shelve_cache): Use it. | 59 | (bidi_cache_ensure_space, bidi_shelve_cache): Use it. |
| 60 | (bidi_cache_ensure_space): Avoid integer overflow when allocating. | 60 | (bidi_cache_ensure_space): Avoid integer overflow when allocating. |
| 61 | 61 | ||
| 62 | * bidi.c (bidi_cache_shrink): | ||
| 62 | * buffer.c (overlays_at, overlays_in, record_overlay_string) | 63 | * buffer.c (overlays_at, overlays_in, record_overlay_string) |
| 63 | (overlay_strings): | 64 | (overlay_strings): |
| 64 | Don't update size of array until after memory allocation succeeds, | 65 | 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) | |||
| 350 | { | 350 | { |
| 351 | if (bidi_cache_size > BIDI_CACHE_CHUNK) | 351 | if (bidi_cache_size > BIDI_CACHE_CHUNK) |
| 352 | { | 352 | { |
| 353 | bidi_cache_size = BIDI_CACHE_CHUNK; | ||
| 354 | bidi_cache = | 353 | bidi_cache = |
| 355 | (struct bidi_it *) xrealloc (bidi_cache, bidi_cache_size * elsz); | 354 | (struct bidi_it *) xrealloc (bidi_cache, BIDI_CACHE_CHUNK * elsz); |
| 355 | bidi_cache_size = BIDI_CACHE_CHUNK; | ||
| 356 | } | 356 | } |
| 357 | bidi_cache_reset (); | 357 | bidi_cache_reset (); |
| 358 | } | 358 | } |