mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 22:44:49 +00:00
ICU-9581 Fix some memory leaks in arabic shaping code
X-SVN-Rev: 32491
This commit is contained in:
parent
b56dee8547
commit
8aa34fd449
1 changed files with 10 additions and 22 deletions
|
@ -724,14 +724,15 @@ handleGeneratedSpaces(UChar *dest, int32_t sourceLength,
|
|||
}
|
||||
}
|
||||
|
||||
if (lamAlefOption || tashkeelOption){
|
||||
tempbuffer = (UChar *)uprv_malloc((sourceLength+1)*U_SIZEOF_UCHAR);
|
||||
/* Test for NULL */
|
||||
if(tempbuffer == NULL) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
tempbuffer = (UChar *)uprv_malloc((sourceLength+1)*U_SIZEOF_UCHAR);
|
||||
/* Test for NULL */
|
||||
if(tempbuffer == NULL) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (lamAlefOption || tashkeelOption){
|
||||
uprv_memset(tempbuffer, 0, (sourceLength+1)*U_SIZEOF_UCHAR);
|
||||
|
||||
i = j = 0; count = 0;
|
||||
|
@ -791,16 +792,10 @@ handleGeneratedSpaces(UChar *dest, int32_t sourceLength,
|
|||
}
|
||||
|
||||
if(lamAlefOption || tashkeelOption){
|
||||
tempbuffer = (UChar *)uprv_malloc((sourceLength+1)*U_SIZEOF_UCHAR);
|
||||
|
||||
/* Test for NULL */
|
||||
if(tempbuffer == NULL) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uprv_memset(tempbuffer, 0, (sourceLength+1)*U_SIZEOF_UCHAR);
|
||||
|
||||
i = j = sourceLength; count = 0;
|
||||
|
||||
while(i >= 0) {
|
||||
if ( (lamAlefOption && dest[i] == LAMALEF_SPACE_SUB) ||
|
||||
(tashkeelOption && dest[i] == TASHKEEL_SPACE_SUB) ){
|
||||
|
@ -838,13 +833,6 @@ handleGeneratedSpaces(UChar *dest, int32_t sourceLength,
|
|||
}
|
||||
|
||||
if(lamAlefOption || tashkeelOption){
|
||||
tempbuffer = (UChar *)uprv_malloc((sourceLength+1)*U_SIZEOF_UCHAR);
|
||||
/* Test for NULL */
|
||||
if(tempbuffer == NULL) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uprv_memset(tempbuffer, 0, (sourceLength+1)*U_SIZEOF_UCHAR);
|
||||
|
||||
i = j = 0; count = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue