From e823709d1755cb4fd087f2a9ba92d350dd32fe47 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 26 Aug 2020 00:07:09 -0700 Subject: [PATCH] regex-emacs: copy less when reallocating * src/regex-emacs.c (GROW_FAIL_STACK): Copy just the occupied stack slots, as the rest are garbage. --- src/regex-emacs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)), \ -- 2.39.2