@@ -228,7 +228,7 @@ _internal_toASCII(const char16_t* src, int32_t srcLength,
228228 }
229229
230230 if (srcLength > b1Capacity){
231- b1 = static_cast <char16_t *>(uprv_malloc (srcLength * U_SIZEOF_UCHAR ));
231+ b1 = static_cast <char16_t *>(uprv_calloc (srcLength, U_SIZEOF_UCHAR ));
232232 if (b1==nullptr ){
233233 *status = U_MEMORY_ALLOCATION_ERROR ;
234234 goto CLEANUP ;
@@ -257,7 +257,7 @@ _internal_toASCII(const char16_t* src, int32_t srcLength,
257257 if (b1 != b1Stack){
258258 uprv_free (b1);
259259 }
260- b1 = static_cast <char16_t *>(uprv_malloc (b1Len * U_SIZEOF_UCHAR ));
260+ b1 = static_cast <char16_t *>(uprv_calloc (b1Len, U_SIZEOF_UCHAR ));
261261 if (b1==nullptr ){
262262 *status = U_MEMORY_ALLOCATION_ERROR ;
263263 goto CLEANUP ;
@@ -343,7 +343,7 @@ _internal_toASCII(const char16_t* src, int32_t srcLength,
343343 if (bufferStatus == U_BUFFER_OVERFLOW_ERROR ){
344344 // redo processing of string
345345 /* we do not have enough room so grow the buffer*/
346- b2 = static_cast <char16_t *>(uprv_malloc (b2Len * U_SIZEOF_UCHAR ));
346+ b2 = static_cast <char16_t *>(uprv_calloc (b2Len, U_SIZEOF_UCHAR ));
347347 if (b2 == nullptr ){
348348 *status = U_MEMORY_ALLOCATION_ERROR ;
349349 goto CLEANUP ;
@@ -465,7 +465,7 @@ _internal_toUnicode(const char16_t* src, int32_t srcLength,
465465 if (bufferStatus == U_BUFFER_OVERFLOW_ERROR ){
466466 // redo processing of string
467467 /* we do not have enough room so grow the buffer*/
468- b1 = static_cast <char16_t *>(uprv_malloc (b1Len * U_SIZEOF_UCHAR ));
468+ b1 = static_cast <char16_t *>(uprv_calloc (b1Len, U_SIZEOF_UCHAR ));
469469 if (b1==nullptr ){
470470 *status = U_MEMORY_ALLOCATION_ERROR ;
471471 goto CLEANUP ;
@@ -507,7 +507,7 @@ _internal_toUnicode(const char16_t* src, int32_t srcLength,
507507 if (bufferStatus == U_BUFFER_OVERFLOW_ERROR ){
508508 // redo processing of string
509509 /* we do not have enough room so grow the buffer*/
510- b2 = static_cast <char16_t *>(uprv_malloc (b2Len * U_SIZEOF_UCHAR ));
510+ b2 = static_cast <char16_t *>(uprv_calloc (b2Len, U_SIZEOF_UCHAR ));
511511 if (b2==nullptr ){
512512 *status = U_MEMORY_ALLOCATION_ERROR ;
513513 goto CLEANUP ;
@@ -525,7 +525,7 @@ _internal_toUnicode(const char16_t* src, int32_t srcLength,
525525 if (bufferStatus == U_BUFFER_OVERFLOW_ERROR ){
526526 // redo processing of string
527527 /* we do not have enough room so grow the buffer*/
528- b3 = static_cast <char16_t *>(uprv_malloc (b3Len * U_SIZEOF_UCHAR ));
528+ b3 = static_cast <char16_t *>(uprv_calloc (b3Len, U_SIZEOF_UCHAR ));
529529 if (b3==nullptr ){
530530 *status = U_MEMORY_ALLOCATION_ERROR ;
531531 goto CLEANUP ;
@@ -888,7 +888,7 @@ uidna_compare( const char16_t *s1, int32_t length1,
888888 b1Len = uidna_IDNToASCII (s1, length1, b1, b1Capacity, options, &parseError, &bufferStatus);
889889 if (bufferStatus == U_BUFFER_OVERFLOW_ERROR ){
890890 // redo processing of string
891- b1 = (char16_t *) uprv_malloc (b1Len * U_SIZEOF_UCHAR );
891+ b1 = (char16_t *) uprv_calloc (b1Len, U_SIZEOF_UCHAR );
892892 if (b1==nullptr ){
893893 *status = U_MEMORY_ALLOCATION_ERROR ;
894894 goto CLEANUP ;
@@ -902,7 +902,7 @@ uidna_compare( const char16_t *s1, int32_t length1,
902902 b2Len = uidna_IDNToASCII (s2,length2, b2,b2Capacity, options, &parseError, &bufferStatus);
903903 if (bufferStatus == U_BUFFER_OVERFLOW_ERROR ){
904904 // redo processing of string
905- b2 = (char16_t *) uprv_malloc (b2Len * U_SIZEOF_UCHAR );
905+ b2 = (char16_t *) uprv_calloc (b2Len, U_SIZEOF_UCHAR );
906906 if (b2==nullptr ){
907907 *status = U_MEMORY_ALLOCATION_ERROR ;
908908 goto CLEANUP ;
0 commit comments