readline/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Wed, 29 Jun 2011 20:51:10 +0000 (20:51 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Wed, 29 Jun 2011 20:51:10 +0000 (20:51 +0000)
Avoid free from a signal handler.
* Makefile.in (xfree.o): Add readline.h.
* xfree.c: Include stdio.h and readline.h.
(xfree): Return on RL_STATE_SIGHANDLER.
* xmalloc.h (xfree): New definition.

readline/ChangeLog.gdb
readline/Makefile.in
readline/xfree.c
readline/xmalloc.h

index 22766a40fc31f7b92fd08a0f847a05cc2cb7457d..229aa31e9d4da8c41d5a19535a286a279117e550 100644 (file)
@@ -1,3 +1,11 @@
+2011-06-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       Avoid free from a signal handler.
+       * Makefile.in (xfree.o): Add readline.h.
+       * xfree.c: Include stdio.h and readline.h.
+       (xfree): Return on RL_STATE_SIGHANDLER.
+       * xmalloc.h (xfree): New definition.
+
 2011-05-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        Workaround gdb.base/completion.exp regression on readline-6.2.
index 23194306bc154a17401425931d4d46a57bb4f9cf..f4ed8110a29eafd0a30de937845e829b697ece9b 100644 (file)
@@ -422,7 +422,7 @@ vi_mode.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h
 vi_mode.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h
 vi_mode.o: history.h ansi_stdlib.h rlstdc.h
 xfree.o: ${BUILD_DIR}/config.h
-xfree.o: ansi_stdlib.h
+xfree.o: ansi_stdlib.h readline.h
 xmalloc.o: ${BUILD_DIR}/config.h
 xmalloc.o: ansi_stdlib.h
 
index 37a81e6c236cbd2d4e8f12951cf32ef8b1942410..d3af7d9aef0b9a420dc9d50faaf6041ab9b016f4 100644 (file)
 #  include "ansi_stdlib.h"
 #endif /* HAVE_STDLIB_H */
 
+#include <stdio.h>
+
 #include "xmalloc.h"
+#include "readline.h"
 
 /* **************************************************************** */
 /*                                                                 */
@@ -45,6 +48,10 @@ void
 xfree (string)
      PTR_T string;
 {
+  /* Leak a bit.  */
+  if (RL_ISSTATE(RL_STATE_SIGHANDLER))
+    return;
+
   if (string)
     free (string);
 }
index f40d7a596a287c3024598f47f769b0694eaf44a5..0fb6a1960e134c64c8999af2aad3028192b16570 100644 (file)
@@ -38,6 +38,9 @@
 
 #endif /* !PTR_T */
 
+/* xmalloc and xrealloc should be also protected from RL_STATE_SIGHANDLER.  */
+#define xfree xfree_readline
+
 extern PTR_T xmalloc PARAMS((size_t));
 extern PTR_T xrealloc PARAMS((void *, size_t));
 extern void xfree PARAMS((void *));
This page took 0.026379 seconds and 4 git commands to generate.