From 351f2820c42992d8ccea50fc0adca6fdf893b7b7 Mon Sep 17 00:00:00 2001 From: Vladimir Weinstein Date: Thu, 8 May 2003 18:06:05 +0000 Subject: [PATCH] ICU-2851 fix a memory leak X-SVN-Rev: 11839 --- icu4c/source/i18n/ucol.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/icu4c/source/i18n/ucol.cpp b/icu4c/source/i18n/ucol.cpp index 0c2fee0f931..52cacb7d862 100644 --- a/icu4c/source/i18n/ucol.cpp +++ b/icu4c/source/i18n/ucol.cpp @@ -8203,12 +8203,14 @@ ucol_equals(const UCollator *source, const UCollator *target) { targetResetString = targetParser.source+(targetReset->source & 0xFFFFFF); targetStringLen = targetReset->source >> 24; if(sourceStringLen != targetStringLen || (u_strncmp(sourceResetString, targetResetString, sourceStringLen) != 0)) { - return FALSE; + result = FALSE; + goto returnResult; } // probably also need to check the expansions if(sourceReset->expansion) { if(!targetReset->expansion) { - return FALSE; + result = FALSE; + goto returnResult; } else { // compare expansions sourceResetString = sourceParser.source+(sourceReset->expansion& 0xFFFFFF); @@ -8216,12 +8218,14 @@ ucol_equals(const UCollator *source, const UCollator *target) { targetResetString = targetParser.source+(targetReset->expansion & 0xFFFFFF); targetStringLen = targetReset->expansion >> 24; if(sourceStringLen != targetStringLen || (u_strncmp(sourceResetString, targetResetString, sourceStringLen) != 0)) { - return FALSE; + result = FALSE; + goto returnResult; } } } else { if(targetReset->expansion) { - return FALSE; + result = FALSE; + goto returnResult; } } sourceReset = sourceReset->next; @@ -8229,7 +8233,8 @@ ucol_equals(const UCollator *source, const UCollator *target) { } if(sourceReset != targetReset) { // at least one is not NULL // there are more tailored elements in one list - return FALSE; + result = FALSE; + goto returnResult; } @@ -8238,11 +8243,13 @@ ucol_equals(const UCollator *source, const UCollator *target) { } // couldn't find the reset anchor, so the collators are not equal if(j == sourceListLen) { - return FALSE; + result = FALSE; + goto returnResult; } } } +returnResult: ucol_tok_closeTokenList(&sourceParser); ucol_tok_closeTokenList(&targetParser); return result;