1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-08 04:30:45 -08:00

regex-emacs: fix leak on memory allocation failure

* src/regex-emacs.c (ENSURE_FAIL_STACK): If the failure
stack cannot be grown, free locally-allocated storage
before returning.
This commit is contained in:
Paul Eggert 2020-08-26 00:07:08 -07:00
parent 4c0a9754ac
commit bd5771ff27

View file

@ -969,7 +969,11 @@ typedef struct
#define ENSURE_FAIL_STACK(space) \
while (REMAINING_AVAIL_SLOTS <= space) { \
if (!GROW_FAIL_STACK (fail_stack)) \
return -2; \
{ \
unbind_to (count, Qnil); \
SAFE_FREE (); \
return -2; \
} \
DEBUG_PRINT ("\n Doubled stack; size now: %td\n", fail_stack.size); \
DEBUG_PRINT (" slots available: %td\n", REMAINING_AVAIL_SLOTS);\
}