From: Martin v. Löwis Date: Fri, 20 Aug 2004 06:26:59 +0000 (+0000) Subject: Fail fatally if strdup fails. X-Git-Tag: v2.4a3~177 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=701abe745b28024662886c254a4dbc2ee1dddb3a;p=thirdparty%2FPython%2Fcpython.git Fail fatally if strdup fails. --- diff --git a/Modules/readline.c b/Modules/readline.c index 5e771d985741..67ae04db33ef 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;