--- icu/source/i18n/smpdtfmt.cpp.orig 2014-08-27 10:29:29.849821672 +0530 +++ icu/source/i18n/smpdtfmt.cpp 2014-08-27 10:29:49.323821401 +0530 @@ -1082,6 +1082,7 @@ } } else { status = U_MEMORY_ALLOCATION_ERROR; + return; } } umtx_unlock(&LOCK); --- icu/source/common/usprep.cpp.orig 2014-08-27 10:38:24.360821077 +0530 +++ icu/source/common/usprep.cpp 2014-08-27 10:38:38.696821312 +0530 @@ -796,16 +796,23 @@ usprep_prepare( const UStringPrepProfi } CLEANUP: - if(b1!=b1Stack){ - uprv_free(b1); - b1=NULL; - } - - if(b2!=b1Stack && b2!=b2Stack && b2!=b1 /* b1 should not be freed twice */){ - uprv_free(b2); - b2=NULL; - } - return u_terminateUChars(dest, destCapacity, b2Len, status); + if(b2==b1 && b1!=b1Stack){ + uprv_free(b1); + b1=NULL; + b2=NULL; + } + else + { + if(b1!=b1Stack){ + uprv_free(b1); + b1=NULL; + } + if(b2!=b1Stack && b2!=b2Stack && b2!=b1 /* b1 should not be freed twice */){ + uprv_free(b2); + b2=NULL; + } + } + return u_terminateUChars(dest, destCapacity, b2Len, status); }