From: Paul Eggert Date: Wed, 26 Aug 2020 07:07:09 +0000 (-0700) Subject: regex-emacs: copy less when reallocating X-Git-Tag: emacs-28.0.90~6393 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e823709d1755cb4fd087f2a9ba92d350dd32fe47;p=emacs.git regex-emacs: copy less when reallocating * src/regex-emacs.c (GROW_FAIL_STACK): Copy just the occupied stack slots, as the rest are garbage. --- diff --git a/src/regex-emacs.c b/src/regex-emacs.c index 3d8aaf4bb13..971a5f63749 100644 --- a/src/regex-emacs.c +++ b/src/regex-emacs.c @@ -929,7 +929,7 @@ typedef struct ? 0 \ : ((fail_stack).stack \ = REGEX_REALLOCATE ((fail_stack).stack, \ - (fail_stack).size * sizeof (fail_stack_elt_t), \ + (fail_stack).avail * sizeof (fail_stack_elt_t), \ min (emacs_re_max_failures * TYPICAL_FAILURE_SIZE, \ ((fail_stack).size * FAIL_STACK_GROWTH_FACTOR)) \ * sizeof (fail_stack_elt_t)), \