ICU-10983 Add failure checks to utext_clone().

X-SVN-Rev: 35986
This commit is contained in:
Andy Heninger 2014-07-02 20:31:42 +00:00
parent 4de6a9f525
commit 03e1202db7

View File

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2005-2013, International Business Machines
* Copyright (C) 2005-2014, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -516,8 +516,17 @@ utext_copy(UText *ut,
U_CAPI UText * U_EXPORT2
utext_clone(UText *dest, const UText *src, UBool deep, UBool readOnly, UErrorCode *status) {
UText *result;
result = src->pFuncs->clone(dest, src, deep, status);
if (U_FAILURE(*status)) {
return dest;
}
UText *result = src->pFuncs->clone(dest, src, deep, status);
if (U_FAILURE(*status)) {
return result;
}
if (result == NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
return result;
}
if (readOnly) {
utext_freeze(result);
}