From 13bbe4f77da274a4950006e2e1fcde59bd61cbcd Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Sat, 30 Jan 2010 07:43:37 +0000 Subject: [PATCH] ICU-7311 apply patch as per ticket - THANKS! X-SVN-Rev: 27463 --- icu4c/source/samples/msgfmt/util.cpp | 4 ++-- icu4c/source/samples/translit/util.cpp | 4 ++-- icu4c/source/samples/ucnv/convsamp.cpp | 6 +++++- icu4c/source/samples/ugrep/ugrep.cpp | 3 ++- icu4c/source/test/cintltst/bocu1tst.c | 3 ++- icu4c/source/test/cintltst/udatatst.c | 1 + icu4c/source/test/perf/collationperf/collperf.cpp | 4 +++- icu4c/source/tools/gencfu/gencfu.cpp | 7 ++++--- 8 files changed, 21 insertions(+), 11 deletions(-) diff --git a/icu4c/source/samples/msgfmt/util.cpp b/icu4c/source/samples/msgfmt/util.cpp index 25a8f0224d4..9f0013c3b46 100644 --- a/icu4c/source/samples/msgfmt/util.cpp +++ b/icu4c/source/samples/msgfmt/util.cpp @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1999-2002, International Business Machines Corporation and + * Copyright (c) 1999-2010, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ @@ -59,5 +59,5 @@ void uprintf(const UnicodeString &str) { actualLen = str.extract(0, len, buf/*, bufLen*/); // Default codepage conversion buf[actualLen] = 0; printf("%s", buf); - delete buf; + delete [] buf; } diff --git a/icu4c/source/samples/translit/util.cpp b/icu4c/source/samples/translit/util.cpp index 25a8f0224d4..9f0013c3b46 100644 --- a/icu4c/source/samples/translit/util.cpp +++ b/icu4c/source/samples/translit/util.cpp @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1999-2002, International Business Machines Corporation and + * Copyright (c) 1999-2010, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ @@ -59,5 +59,5 @@ void uprintf(const UnicodeString &str) { actualLen = str.extract(0, len, buf/*, bufLen*/); // Default codepage conversion buf[actualLen] = 0; printf("%s", buf); - delete buf; + delete [] buf; } diff --git a/icu4c/source/samples/ucnv/convsamp.cpp b/icu4c/source/samples/ucnv/convsamp.cpp index 70b43b6512b..99cb4dfb32e 100644 --- a/icu4c/source/samples/ucnv/convsamp.cpp +++ b/icu4c/source/samples/ucnv/convsamp.cpp @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (C) 2000-2003, International Business Machines +* Copyright (C) 2000-2010, International Business Machines * Corporation and others. All Rights Reserved. * *************************************************************************** @@ -374,6 +374,8 @@ UErrorCode convsample_05() printf("\n"); + fclose(f); + return U_ZERO_ERROR; } #undef BUFFERSIZE @@ -895,6 +897,7 @@ UErrorCode convsample_40() if(!out) { fprintf(stderr, "Couldn't create file 'data40.utf16'.\n"); + fclose(f); return U_FILE_ACCESS_ERROR; } @@ -1000,6 +1003,7 @@ UErrorCode convsample_46() if(!out) { fprintf(stderr, "Couldn't create file 'data46.out'.\n"); + fclose(f); return U_FILE_ACCESS_ERROR; } diff --git a/icu4c/source/samples/ugrep/ugrep.cpp b/icu4c/source/samples/ugrep/ugrep.cpp index 0eeba6802aa..752df4c4740 100644 --- a/icu4c/source/samples/ugrep/ugrep.cpp +++ b/icu4c/source/samples/ugrep/ugrep.cpp @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (C) 2002, International Business Machines +* Copyright (C) 2002-2010, International Business Machines * Corporation and others. All Rights Reserved. * *************************************************************************** @@ -287,6 +287,7 @@ void readFile(const char *name) { int t = fread(charBuf, 1, rawFileLen, file); if (t != rawFileLen) { fprintf(stderr, "Error reading file \"%s\"\n", fileName); + fclose(file); return; } charBuf[rawFileLen]=0; diff --git a/icu4c/source/test/cintltst/bocu1tst.c b/icu4c/source/test/cintltst/bocu1tst.c index 0616b1cff9e..03a6f56c75e 100644 --- a/icu4c/source/test/cintltst/bocu1tst.c +++ b/icu4c/source/test/cintltst/bocu1tst.c @@ -1,7 +1,7 @@ /* ****************************************************************************** * -* Copyright (C) 2002-2007, International Business Machines +* Copyright (C) 2002-2010, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** @@ -906,6 +906,7 @@ roundtripBOCU1(UConverter *bocu1, int32_t number, const UChar *text, int32_t len /* BOCU-1 -> Unicode */ roundtripRefLength=readString((uint8_t *)bocu1Ref, bocu1RefLength, roundtripRef); if(roundtripRefLength<0) { + free(roundtripICU); return; /* readString() found an error and reported it */ } diff --git a/icu4c/source/test/cintltst/udatatst.c b/icu4c/source/test/cintltst/udatatst.c index a5c6688d1df..e09fad2fb23 100644 --- a/icu4c/source/test/cintltst/udatatst.c +++ b/icu4c/source/test/cintltst/udatatst.c @@ -136,6 +136,7 @@ static void TestUDataOpen(){ const char* testPath=loadTestData(&status); if(U_FAILURE(status)) { log_data_err("Could not load testdata.dat, status = %s\n", u_errorName(status)); + free(path); return; } diff --git a/icu4c/source/test/perf/collationperf/collperf.cpp b/icu4c/source/test/perf/collationperf/collperf.cpp index 10f93435fb5..6a4f7ad4ca3 100644 --- a/icu4c/source/test/perf/collationperf/collperf.cpp +++ b/icu4c/source/test/perf/collationperf/collperf.cpp @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (C) 2001-2009 IBM, Inc. All Rights Reserved. + * Copyright (C) 2001-2010 IBM, Inc. All Rights Reserved. * ********************************************************************/ /******************************************************************************** @@ -808,6 +808,8 @@ void doKeyHist() { (float)accumulatedLen[i] / (float)(numKeysOfSize[i] * i)); } } + delete []accumulatedLen; + delete []numKeysOfSize ; } //--------------------------------------------------------------------------------------- diff --git a/icu4c/source/tools/gencfu/gencfu.cpp b/icu4c/source/tools/gencfu/gencfu.cpp index 3df5884e502..7e92f76ada7 100644 --- a/icu4c/source/tools/gencfu/gencfu.cpp +++ b/icu4c/source/tools/gencfu/gencfu.cpp @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (C) 2009, International Business Machines +* Copyright (C) 2009-2010, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * @@ -286,7 +286,7 @@ int main(int argc, char **argv) { } uspoof_close(sc); - delete outData; + delete [] outData; delete confusables; delete wsConfsables; u_cleanup(); @@ -318,7 +318,8 @@ int main(int argc, char **argv) { long t = fread(result, 1, fileSize, file); if (t != fileSize) { - delete result; + delete [] result; + fclose(file); return NULL; } result[fileSize]=0;