ICU-11177 Fixed a potential memory leak in setParaRunsOnly() in ubidi.c

X-SVN-Rev: 36929
This commit is contained in:
Yoshito Umaoka 2015-01-07 21:32:52 +00:00
parent a31ce73748
commit bc68cc5b15

View file

@ -1,7 +1,7 @@
/*
******************************************************************************
*
* Copyright (C) 1999-2014, International Business Machines
* Copyright (C) 1999-2015, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
@ -2340,7 +2340,7 @@ setParaSuccess(UBiDi *pBiDi) {
static void
setParaRunsOnly(UBiDi *pBiDi, const UChar *text, int32_t length,
UBiDiLevel paraLevel, UErrorCode *pErrorCode) {
void *runsOnlyMemory;
void *runsOnlyMemory = NULL;
int32_t *visualMap;
UChar *visualText;
int32_t saveLength, saveTrailingWSStart;
@ -2514,12 +2514,13 @@ setParaRunsOnly(UBiDi *pBiDi, const UChar *text, int32_t length,
}
uprv_memcpy(pBiDi->levels, saveLevels, saveLength*sizeof(UBiDiLevel));
pBiDi->trailingWSStart=saveTrailingWSStart;
/* free memory for mapping table and visual text */
uprv_free(runsOnlyMemory);
if(pBiDi->runCount>1) {
pBiDi->direction=UBIDI_MIXED;
}
cleanup3:
/* free memory for mapping table and visual text */
uprv_free(runsOnlyMemory);
pBiDi->reorderingMode=UBIDI_REORDER_RUNS_ONLY;
}