From ea8a7d00f9678471e960117b0b87318dcf4e7d81 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 28 Jul 2011 18:01:17 -0700 Subject: [PATCH] * minibuf.c (read_minibuf_noninteractive): Don't leak memory on memory overflow. --- src/ChangeLog | 3 +++ src/minibuf.c | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 435d883e14f..4e10537edc8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-07-29 Paul Eggert + * minibuf.c (read_minibuf_noninteractive): Don't leak memory + on memory overflow. + * macros.c: Integer and memory overflow fixes. (Fstart_kbd_macro): Don't update size until alloc done. (store_kbd_macro_char): Reorder multiplicands to avoid overflow. diff --git a/src/minibuf.c b/src/minibuf.c index eb564a10ec6..30082af9037 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -261,7 +261,10 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial, if (len == size) { if (STRING_BYTES_BOUND / 2 < size) - memory_full (SIZE_MAX); + { + xfree (line); + memory_full (SIZE_MAX); + } size *= 2; line = (char *) xrealloc (line, size); } -- 2.39.2