summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2004-08-20 06:26:59 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2004-08-20 06:26:59 (GMT)
commit701abe745b28024662886c254a4dbc2ee1dddb3a (patch)
treefed40bb127053843cdee882acd2588212c4a6ab2
parentcd4d297a239b3f1eb7f7b9e4d54733a8905a3a67 (diff)
downloadcpython-701abe745b28024662886c254a4dbc2ee1dddb3a.zip
cpython-701abe745b28024662886c254a4dbc2ee1dddb3a.tar.gz
cpython-701abe745b28024662886c254a4dbc2ee1dddb3a.tar.bz2
Fail fatally if strdup fails.
-rw-r--r--Modules/readline.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/readline.c b/Modules/readline.c
index 5e771d9..67ae04d 100644
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -675,6 +675,8 @@ setup_readline(void)
{
#ifdef SAVE_LOCALE
char *saved_locale = strdup(setlocale(LC_CTYPE, NULL));
+ if (!saved_locale)
+ Py_FatalError("not enough memory to save locale");
#endif
using_history();
@@ -823,6 +825,8 @@ call_readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
{
#ifdef SAVE_LOCALE
char *saved_locale = strdup(setlocale(LC_CTYPE, NULL));
+ if (!saved_locale)
+ Py_FatalError("not enough memory to save locale");
setlocale(LC_CTYPE, "");
#endif
size_t n;