Révision | 0d1b033387342e34b9d3a973dfe40d31dc1a07b4 (tree) |
---|---|
l'heure | 2011-06-30 05:51:10 |
Auteur | Jan Kratochvil <jan.kratochvil@redh...> |
Commiter | Jan Kratochvil |
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.
@@ -1,3 +1,11 @@ | ||
1 | +2011-06-29 Jan Kratochvil <jan.kratochvil@redhat.com> | |
2 | + | |
3 | + Avoid free from a signal handler. | |
4 | + * Makefile.in (xfree.o): Add readline.h. | |
5 | + * xfree.c: Include stdio.h and readline.h. | |
6 | + (xfree): Return on RL_STATE_SIGHANDLER. | |
7 | + * xmalloc.h (xfree): New definition. | |
8 | + | |
1 | 9 | 2011-05-11 Jan Kratochvil <jan.kratochvil@redhat.com> |
2 | 10 | |
3 | 11 | Workaround gdb.base/completion.exp regression on readline-6.2. |
@@ -422,7 +422,7 @@ vi_mode.o: rldefs.h ${BUILD_DIR}/config.h rlconf.h | ||
422 | 422 | vi_mode.o: readline.h keymaps.h rltypedefs.h chardefs.h tilde.h |
423 | 423 | vi_mode.o: history.h ansi_stdlib.h rlstdc.h |
424 | 424 | xfree.o: ${BUILD_DIR}/config.h |
425 | -xfree.o: ansi_stdlib.h | |
425 | +xfree.o: ansi_stdlib.h readline.h | |
426 | 426 | xmalloc.o: ${BUILD_DIR}/config.h |
427 | 427 | xmalloc.o: ansi_stdlib.h |
428 | 428 |
@@ -31,7 +31,10 @@ | ||
31 | 31 | # include "ansi_stdlib.h" |
32 | 32 | #endif /* HAVE_STDLIB_H */ |
33 | 33 | |
34 | +#include <stdio.h> | |
35 | + | |
34 | 36 | #include "xmalloc.h" |
37 | +#include "readline.h" | |
35 | 38 | |
36 | 39 | /* **************************************************************** */ |
37 | 40 | /* */ |
@@ -45,6 +48,10 @@ void | ||
45 | 48 | xfree (string) |
46 | 49 | PTR_T string; |
47 | 50 | { |
51 | + /* Leak a bit. */ | |
52 | + if (RL_ISSTATE(RL_STATE_SIGHANDLER)) | |
53 | + return; | |
54 | + | |
48 | 55 | if (string) |
49 | 56 | free (string); |
50 | 57 | } |
@@ -38,6 +38,9 @@ | ||
38 | 38 | |
39 | 39 | #endif /* !PTR_T */ |
40 | 40 | |
41 | +/* xmalloc and xrealloc should be also protected from RL_STATE_SIGHANDLER. */ | |
42 | +#define xfree xfree_readline | |
43 | + | |
41 | 44 | extern PTR_T xmalloc PARAMS((size_t)); |
42 | 45 | extern PTR_T xrealloc PARAMS((void *, size_t)); |
43 | 46 | extern void xfree PARAMS((void *)); |