summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2004-08-20 06:29:14 +0000
committerMartin v. Löwis <martin@v.loewis.de>2004-08-20 06:29:14 +0000
commit78c2a2e039ef031593554dfc36744eb3c7ec0230 (patch)
treeb2a655653637e6396e6f48b02e509c5ab6e69272 /Modules
parentd903fc05344a36d2dc470e5bf93690b784bb6a9d (diff)
downloadcpython-git-78c2a2e039ef031593554dfc36744eb3c7ec0230.tar.gz
Fail fatally if strdup fails.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/readline.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/readline.c b/Modules/readline.c
index dea58e4b76..fd6f95cedd 100644
--- a/Modules/readline.c
+++ b/Modules/readline.c
@@ -591,6 +591,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();
@@ -655,6 +657,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;