]> git.eshelyaron.com Git - emacs.git/commitdiff
regex-emacs: copy less when reallocating
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 26 Aug 2020 07:07:09 +0000 (00:07 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 26 Aug 2020 07:20:31 +0000 (00:20 -0700)
* src/regex-emacs.c (GROW_FAIL_STACK): Copy just the
occupied stack slots, as the rest are garbage.

src/regex-emacs.c

index 3d8aaf4bb1350c14e7b89fe01f2f28e7a02732ea..971a5f63749d4cd071de9814395481ef78bdbbef 100644 (file)
@@ -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)),                                 \