ICU-432 more leaks fixes

X-SVN-Rev: 2231
This commit is contained in:
Vladimir Weinstein 2000-08-14 23:14:23 +00:00
parent 250331389c
commit cc30f756d3
13 changed files with 37 additions and 4 deletions

View File

@ -21,6 +21,7 @@
#include "capitst.h" #include "capitst.h"
#include "unicode/ustring.h" #include "unicode/ustring.h"
#include "unicode/ures.h" #include "unicode/ures.h"
#include "cmemory.h"
U_CAPI const UChar * U_EXPORT2 ucol_getDefaultRulesArray(uint32_t *size); U_CAPI const UChar * U_EXPORT2 ucol_getDefaultRulesArray(uint32_t *size);
@ -94,6 +95,8 @@ void TestGetDefaultRules(){
log_err("Error: ucol_getDefaultRulesArray() failed\n"); log_err("Error: ucol_getDefaultRulesArray() failed\n");
} }
uprv_free(binColData);
ures_close(binColl);
ures_close(res); ures_close(res);
ucol_close(coll); ucol_close(coll);

View File

@ -114,8 +114,12 @@ void currTest()
reportCResult(source, target, sortKey1, sortKey2, reportCResult(source, target, sortKey1, sortKey2,
compareResult, keyResult, expectedResult); compareResult, keyResult, expectedResult);
free(sortKey1);
free(sortKey2);
} }
} }
ucol_close(c);
} }

View File

@ -279,6 +279,7 @@ void TestDemo1()
ucol_close(myCollation); ucol_close(myCollation);
ucol_close(col); ucol_close(col);
free(temp);
free(newRules); free(newRules);
} }
void TestDemo2() void TestDemo2()
@ -322,6 +323,7 @@ void TestDemo2()
} }
ucol_close(myCollation); ucol_close(myCollation);
ucol_close(col); ucol_close(col);
free(temp);
free(newRules); free(newRules);
} }

View File

@ -24,6 +24,8 @@
#include "unicode/ucnv.h" #include "unicode/ucnv.h"
#include "unicode/ures.h" #include "unicode/ures.h"
U_CAPI void U_EXPORT2 ucnv_orphanAllConverters();
static char* _testDirectory=NULL; static char* _testDirectory=NULL;
int main ( int argc, const char **argv ) int main ( int argc, const char **argv )
{ {
@ -79,6 +81,14 @@ int main ( int argc, const char **argv )
cleanUpDataTable(); cleanUpDataTable();
ctst_freeAll(); ctst_freeAll();
#if 0
/* To check for leaks */
ucnv_flushCache();
ucnv_orphanAllConverters(); /* nuke the hashtable.. so that any still-open cnvs are leaked */
/* above function must be enabled in ucnv_bld.c */
#endif
return nerrors ? 1 : 0; return nerrors ? 1 : 0;
} }

View File

@ -307,6 +307,8 @@ void backAndForth(UCollationElements *iter)
log_verbose("\n"); log_verbose("\n");
} }
free(orders);
} }
/** @bug 4108762 /** @bug 4108762

View File

@ -16,6 +16,7 @@
#include "cstring.h" #include "cstring.h"
#include "cintltst.h" #include "cintltst.h"
#include "cmemory.h"
static void TestAPI(void); static void TestAPI(void);
@ -86,6 +87,7 @@ void TestAPI(void)
if(uprv_strcmp(temp, "strdup") !=0 ){ if(uprv_strcmp(temp, "strdup") !=0 ){
log_err("FAIL: uprv_strdup() failed. Expected: \"strdup\", Got: %s\n", temp); log_err("FAIL: uprv_strdup() failed. Expected: \"strdup\", Got: %s\n", temp);
} }
uprv_free((char *)temp);
uprv_strcpy(src, "this is lower case"); uprv_strcpy(src, "this is lower case");
if(T_CString_strnicmp(src, "THIS", 4 ) != 0){ if(T_CString_strnicmp(src, "THIS", 4 ) != 0){

View File

@ -49,6 +49,7 @@ void TestMemoryStreamAPI(){
if(memStream == NULL){ if(memStream == NULL){
log_err("uprv_mstrm_openNew() failed\n"); log_err("uprv_mstrm_openNew() failed\n");
} }
uprv_mstrm_close(memStream);
log_verbose("Testing the function uprv_mstrm_openNew() with size=0\n"); log_verbose("Testing the function uprv_mstrm_openNew() with size=0\n");
memStream=uprv_mstrm_openNew(0); memStream=uprv_mstrm_openNew(0);

View File

@ -302,7 +302,6 @@ void TestErrorBehaviour(){
if(!convertFromU(sampleText4MBCS, sizeof(sampleText4MBCS)/sizeof(sampleText4MBCS[0]), if(!convertFromU(sampleText4MBCS, sizeof(sampleText4MBCS)/sizeof(sampleText4MBCS[0]),
expected4MBCS, sizeof(expected4MBCS), "euc-jp", offsets4MBCS, FALSE, U_ZERO_ERROR)) expected4MBCS, sizeof(expected4MBCS), "euc-jp", offsets4MBCS, FALSE, U_ZERO_ERROR))
log_err("u-> euc-jp [UCNV_MBCS] \n"); log_err("u-> euc-jp [UCNV_MBCS] \n");
} }

View File

@ -558,7 +558,8 @@ void TestErrorConditions(){
} else { } else {
log_verbose("calling udat_open with non-existing file returned null as expected\n"); log_verbose("calling udat_open with non-existing file returned null as expected\n");
} }
free(path);
free(testPath);
} }

View File

@ -167,6 +167,8 @@ void TestClone(){
utrans_close(t1); utrans_close(t1);
utrans_close(t2); utrans_close(t2);
utrans_close(t3);
utrans_close(t4);
} }
@ -223,7 +225,8 @@ void TestRegisterUnregister(){
return; return;
} }
/*utrans_close(rules);*/ utrans_close(t1);
utrans_close(inverse1);
} }
void TestSimpleRules() { void TestSimpleRules() {

View File

@ -264,7 +264,7 @@ void CompoundTransliteratorTest::TestGetSetAdoptTransliterator(){
else{ else{
logln("OK: adoptTranslterator() passed"); logln("OK: adoptTranslterator() passed");
} }
// delete ct1; delete transarray;
} }
/** /**

View File

@ -1134,6 +1134,10 @@ void IntlTestTextBoundary::generalIteratorTest(BreakIterator& bi, Vector* expect
testIsBoundary(bi, text, boundaries); testIsBoundary(bi, text, boundaries);
doMultipleSelectionTest(bi, text); doMultipleSelectionTest(bi, text);
delete nextResults;
delete previousResults;
} }
Vector* IntlTestTextBoundary::testFirstAndNext(BreakIterator& bi, UnicodeString& text) Vector* IntlTestTextBoundary::testFirstAndNext(BreakIterator& bi, UnicodeString& text)

View File

@ -302,6 +302,8 @@ void JamoToHangTransliteratorTest::expectTranslit(const JamoHangulTransliterator
equal.handleTransliterate(rsource2, index, TRUE); equal.handleTransliterate(rsource2, index, TRUE);
expectAux(t.getID() + "=OPERATOR:handleTransliterator(increment=TRUE) "+ message, source + "-->" + rsource2, rsource2==expectedResult, expectedResult); expectAux(t.getID() + "=OPERATOR:handleTransliterator(increment=TRUE) "+ message, source + "-->" + rsource2, rsource2==expectedResult, expectedResult);
delete clone;
} }
void JamoToHangTransliteratorTest::expect(const JamoHangulTransliterator& t, void JamoToHangTransliteratorTest::expect(const JamoHangulTransliterator& t,
const UnicodeString& message, const UnicodeString& message,