aboutsummaryrefslogtreecommitdiff
path: root/readline
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2011-06-29 20:51:10 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2011-06-29 20:51:10 +0000
commit0d1b033387342e34b9d3a973dfe40d31dc1a07b4 (patch)
tree534b87048a872685d20fd4ed7259bd961d0eb2be /readline
parent9fe77896a79cdc7ed17d51f0fdaa0b7153474bc2 (diff)
downloadgdb-0d1b033387342e34b9d3a973dfe40d31dc1a07b4.zip
gdb-0d1b033387342e34b9d3a973dfe40d31dc1a07b4.tar.gz
gdb-0d1b033387342e34b9d3a973dfe40d31dc1a07b4.tar.bz2
readline/
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.
Diffstat (limited to 'readline')
-rw-r--r--readline/ChangeLog.gdb8
-rw-r--r--readline/Makefile.in2
-rw-r--r--readline/xfree.c7
-rw-r--r--readline/xmalloc.h3
4 files changed, 19 insertions, 1 deletions
diff --git a/readline/ChangeLog.gdb b/readline/ChangeLog.gdb
index 22766a4..229aa31 100644
--- a/readline/ChangeLog.gdb
+++ b/readline/ChangeLog.gdb
@@ -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.
diff --git a/readline/Makefile.in b/readline/Makefile.in
index 2319430..f4ed811 100644
--- a/readline/Makefile.in
+++ b/readline/Makefile.in
@@ -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
diff --git a/readline/xfree.c b/readline/xfree.c
index 37a81e6..d3af7d9 100644
--- a/readline/xfree.c
+++ b/readline/xfree.c
@@ -31,7 +31,10 @@
# 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);
}
diff --git a/readline/xmalloc.h b/readline/xmalloc.h
index f40d7a5..0fb6a19 100644
--- a/readline/xmalloc.h
+++ b/readline/xmalloc.h
@@ -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 *));