stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject svn commit: r644821 - /stdcxx/trunk/tests/src/locale.cpp
Date Fri, 04 Apr 2008 18:52:34 GMT
Author: vitek
Date: Fri Apr  4 11:52:32 2008
New Revision: 644821

URL: http://svn.apache.org/viewvc?rev=644821&view=rev
Log:

2008-04-04  Travis Vitek  <vitek@roguewave.com>

	STDCXX-755
	* tests/src/locale.cpp (rw_locales): Check return from malloc()
	(_rw_all_locales): Ditto.


Modified:
    stdcxx/trunk/tests/src/locale.cpp

Modified: stdcxx/trunk/tests/src/locale.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/src/locale.cpp?rev=644821&r1=644820&r2=644821&view=diff
==============================================================================
--- stdcxx/trunk/tests/src/locale.cpp (original)
+++ stdcxx/trunk/tests/src/locale.cpp Fri Apr  4 11:52:32 2008
@@ -373,6 +373,10 @@
     // allocate first time through
     if (!slocname) {
         slocname = _RWSTD_STATIC_CAST (char*, _QUIET_MALLOC (total_size));
+
+        if (!slocname)
+            return deflocname;
+
         *slocname = '\0';
     }
 
@@ -468,6 +472,8 @@
 
                 char* tmp =
                     _RWSTD_STATIC_CAST (char*, _QUIET_MALLOC (total_size));
+                if (!tmp)
+                    break;
 
                 memcpy (tmp, slocname, total_size - grow_size);
 
@@ -1124,7 +1130,7 @@
                     _RWSTD_STATIC_CAST(_rw_locale_entry*,
                                     _QUIET_MALLOC (entry_size * capacity));
                 if (!new_entries) {
-                    return result; // allocation failed
+                    break;
                 }
 
                 memcpy (new_entries, entries, entry_size * size);
@@ -1639,3 +1645,5 @@
 
     return true;
 }
+
+



Mime
View raw message