From 3a74c75e2f4f8cc0c63f452ecac1d880c184e471 Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Mon, 24 May 2004 17:11:40 +0000 Subject: [PATCH] ICU-3718 Don't crash on slow machines X-SVN-Rev: 15497 --- icu4c/source/test/intltest/tsmthred.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/icu4c/source/test/intltest/tsmthred.cpp b/icu4c/source/test/intltest/tsmthred.cpp index 17e071b7e9..2887306822 100644 --- a/icu4c/source/test/intltest/tsmthred.cpp +++ b/icu4c/source/test/intltest/tsmthred.cpp @@ -1514,10 +1514,18 @@ void MultithreadTest::TestString() } cleanupAndReturn: - for(j = 0; j < kStringThreadThreads; j++) { - delete tests[j]; + if (terrs == 0) { + /* + Don't clean up if there are errors. This prevents crashes if the + threads are still running and using this data. This will only happen + if there is an error with the test, ICU, or the machine is too slow. + It's better to leak than crash. + */ + for(j = 0; j < kStringThreadThreads; j++) { + delete tests[j]; + } + delete testString; } - return; }