From abbae792128e2cd36822fb70eda2c3ad563fa71d Mon Sep 17 00:00:00 2001 From: Travis Keep Date: Mon, 10 Feb 2014 22:55:18 +0000 Subject: [PATCH] ICU-10640 Change MeasureFormat::adoptNumberFormat to adhere to ICU users' guide. X-SVN-Rev: 35117 --- icu4c/source/i18n/measfmt.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/icu4c/source/i18n/measfmt.cpp b/icu4c/source/i18n/measfmt.cpp index c9a10685c73..fffdffdc60e 100644 --- a/icu4c/source/i18n/measfmt.cpp +++ b/icu4c/source/i18n/measfmt.cpp @@ -623,16 +623,16 @@ void MeasureFormat::initMeasureFormat( void MeasureFormat::adoptNumberFormat( NumberFormat *nfToAdopt, UErrorCode &status) { + LocalPointer nf(nfToAdopt); if (U_FAILURE(status)) { - delete nfToAdopt; return; } - SharedNumberFormat *shared = new SharedNumberFormat(nfToAdopt); + SharedNumberFormat *shared = new SharedNumberFormat(nf.getAlias()); if (shared == NULL) { status = U_MEMORY_ALLOCATION_ERROR; - delete nfToAdopt; return; } + nf.orphan(); SharedObject::copyPtr(shared, numberFormat); } -- 2.40.0