From cb2212c25f909d89ec27554ee6fcdc14e2e35697 Mon Sep 17 00:00:00 2001 From: Eric Mader Date: Thu, 16 May 2002 19:23:02 +0000 Subject: [PATCH] ICU-1289 uscript_openRun: free UScriptRun if uscript_setRunText returns an error. X-SVN-Rev: 8639 --- icu4c/source/common/uscript.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/icu4c/source/common/uscript.c b/icu4c/source/common/uscript.c index 757593a877a..855c41867e6 100644 --- a/icu4c/source/common/uscript.c +++ b/icu4c/source/common/uscript.c @@ -518,7 +518,12 @@ uscript_openRun(const UChar *src, int32_t length, UErrorCode *pErrorCode) uscript_setRunText(result, src, length, pErrorCode); - /* FIXME: should we free result if setRunText fails? */ + /* Release the UScriptRun if uscript_setRunText() returns an error */ + if (U_FAILURE(*pErrorCode)) { + uprv_free(result); + result = NULL; + } + return result; }