]> git.eshelyaron.com Git - emacs.git/commitdiff
* minibuf.c (read_minibuf_noninteractive): Don't leak memory
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 29 Jul 2011 01:01:17 +0000 (18:01 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 29 Jul 2011 01:01:17 +0000 (18:01 -0700)
on memory overflow.

src/ChangeLog
src/minibuf.c

index 435d883e14f9e2b7268b4ac1c420ad0b21e9bcfe..4e10537edc8e43e449bcd4553ba39b7d87dbf744 100644 (file)
@@ -1,5 +1,8 @@
 2011-07-29  Paul Eggert  <eggert@cs.ucla.edu>
 
+       * 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.
index eb564a10ec6f8099590ec36ec0e6d7823e0a0500..30082af90376d4c1e7f36ace4d075a1bd3ef45e5 100644 (file)
@@ -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);
            }