From: Paul Eggert Date: Fri, 29 Jul 2011 01:01:17 +0000 (-0700) Subject: * minibuf.c (read_minibuf_noninteractive): Don't leak memory X-Git-Tag: emacs-pretest-24.0.90~104^2~152^2~108 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ea8a7d00f9678471e960117b0b87318dcf4e7d81;p=emacs.git * minibuf.c (read_minibuf_noninteractive): Don't leak memory on memory overflow. --- 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); }