From d314acc0ba326a92cfaf387d68bf9957e5b8891b Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Fri, 11 Jul 2003 20:16:05 +0000 Subject: [PATCH] out of memory for strdup handled git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21899 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/wxchar.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/common/wxchar.cpp b/src/common/wxchar.cpp index 571d165d3d..eaa2b5b4e7 100644 --- a/src/common/wxchar.cpp +++ b/src/common/wxchar.cpp @@ -1387,7 +1387,10 @@ WXDLLEXPORT wxChar * wxStrtok(wxChar *psz, const wxChar *delim, wxChar **save_pt #if __MSL__ < 0x00008000 char *strdup(const char *s) { - return strcpy( (char*) malloc( strlen( s ) + 1 ) , s ) ; + char *dest = (char*) malloc( strlen( s ) + 1 ) ; + if ( dest ) + strcpy( dest , s ) ; + return dest ; } #endif int isascii( int c ) -- 2.49.0