From d2d8f0ec8f4a2d230a0d8b63e1aeeafc13e7e2b0 Mon Sep 17 00:00:00 2001 From: Nebojsa Ciric <cira@chromium.org> Date: Tue, 12 Feb 2019 11:23:22 -0800 Subject: [PATCH] ICU-11991 Fixed memory leak in parse.cpp Squashed commits for merge. --- icu4c/source/tools/genrb/parse.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/icu4c/source/tools/genrb/parse.cpp b/icu4c/source/tools/genrb/parse.cpp index 44eb0c082bc..884d5d56660 100644 --- a/icu4c/source/tools/genrb/parse.cpp +++ b/icu4c/source/tools/genrb/parse.cpp @@ -537,7 +537,7 @@ parseDependency(ParseState* state, char *tag, uint32_t startline, const struct U uint32_t line; char filename[256] = { '\0' }; char cs[128] = { '\0' }; - + expect(state, TOK_STRING, &tokenValue, NULL, &line, status); if(isVerbose()){ @@ -558,7 +558,7 @@ parseDependency(ParseState* state, char *tag, uint32_t startline, const struct U uprv_strcat(filename, U_FILE_SEP_STRING); } } - + u_UCharsToChars(tokenValue->fChars, cs, tokenValue->fLength); if (U_FAILURE(*status)) @@ -570,7 +570,7 @@ parseDependency(ParseState* state, char *tag, uint32_t startline, const struct U if(isStrict()){ error(line, "The dependency file %s does not exist. Please make sure it exists.\n",filename); }else{ - warning(line, "The dependency file %s does not exist. Please make sure it exists.\n",filename); + warning(line, "The dependency file %s does not exist. Please make sure it exists.\n",filename); } } if(dependencyArray==NULL){ @@ -2000,6 +2000,8 @@ parse(UCHARBUF *buf, const char *inputDir, const char *outputDir, const char *fi if (state.bundle == NULL || U_FAILURE(*status)) { + delete state.bundle; + return NULL; } -- 2.40.0