DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21990>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21990

ICULCPTranscoder::transcode memory leak





------- Additional Comments From [EMAIL PROTECTED]  2003-08-23 20:18 -------
ICU's ucnv_fromUChars() does not terminate a converted string when 'given 
buffer size' == 'converted string length'.

>That way, there's no need to check for the extra return value.
Even if the code is modified in that way, termination would not be done by 
ucnv_fromUChars() when targetLen == (the length of a converted string).  Xerces 
code is required to do null-termination.

By introducing an extra warning check ( in other words, no-null-termination 
check) like my patch, Xerces code is not required to do null-termination.

>It seems to me the code should really be using ucnv_fromUnicode().
ucnv_fromUChars() internally uses ucnv_fromUnicode().

The first attempt of conversion is done by using ucnv_fromUnicode().
When the first attempt fails due to shortage of buffer capacity, 
ucnv_fromUChars() calculates the length of the converted string by doing whole 
conversion by using ucnv_fromUnicode() again.  Xerces code uses this calculated 
length to reallocate a new buffer when the firstly-allocated buffer is not 
enough.

It would be an another way to rewrite this method with ucnv_fromUnicode(), 
which might be very simlar to the implementaion of ucnv_fromUChars().

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to