ICU-1007 memory cleanup

X-SVN-Rev: 5701
This commit is contained in:
Markus Scherer 2001-09-06 01:20:43 +00:00
parent 2bdcad5bb8
commit 6cc849aea3

View file

@ -130,6 +130,18 @@ static UVersionInfo dataVersion={ 3, 1, 0, 0 };
U_CDECL_BEGIN
U_CFUNC UBool U_CALLCONV
unorm_cleanup() {
if(normData!=NULL) {
udata_close(normData);
normData=NULL;
}
dataErrorCode=U_ZERO_ERROR;
haveNormData=0;
return TRUE;
}
static UBool U_CALLCONV
isAcceptable(void * /* context */,
const char * /* type */, const char * /* name */,
@ -2055,7 +2067,8 @@ unorm_compose(UChar *dest, int32_t destCapacity,
pErrorCode);
if(p==NULL) {
return 0; /* an error occurred (out of memory) */
destIndex=0; /* an error occurred (out of memory) */
break;
}
/* append the recomposed buffer contents to the destination buffer */
@ -2112,6 +2125,11 @@ unorm_compose(UChar *dest, int32_t destCapacity,
}
}
/* cleanup */
if(buffer!=stackBuffer) {
uprv_free(buffer);
}
return u_terminateUChars(dest, destCapacity, destIndex, pErrorCode);
}