diff -urN icu.old/source/common/uloc_keytype.cpp icu/source/common/uloc_keytype.cpp
--- icu.old/source/common/uloc_keytype.cpp 2017-02-01 01:21:30.000000000 +0530
+++ icu/source/common/uloc_keytype.cpp 2018-09-23 18:48:04.414990551 +0530
@@ -383,6 +383,7 @@
LocExtKeyData* keyData = (LocExtKeyData*)uprv_malloc(sizeof(LocExtKeyData));
if (keyData == NULL) {
sts = U_MEMORY_ALLOCATION_ERROR;
+ uprv_free(typeDataMap);
break;
}
keyData->bcpId = bcpKeyId;
diff -urN icu.old/source/common/uloc_tag.cpp icu/source/common/uloc_tag.cpp
--- icu.old/source/common/uloc_tag.cpp 2017-10-11 21:54:34.000000000 +0530
+++ icu/source/common/uloc_tag.cpp 2018-09-23 18:48:58.207182317 +0530
@@ -2145,6 +2145,7 @@
error:
ultag_close(t);
+ uprv_free(pExtension);
return NULL;
}
diff -urN icu.old/source/i18n/olsontz.cpp icu/source/i18n/olsontz.cpp
--- icu.old/source/i18n/olsontz.cpp 2017-02-01 01:21:27.000000000 +0530
+++ icu/source/i18n/olsontz.cpp 2018-09-23 18:52:02.140418739 +0530
@@ -787,6 +787,7 @@
if (historicRules[typeIdx] == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
deleteTransitionRules();
+ uprv_free(times);
return;
}
}
diff -urN icu.old/source/i18n/rbt_pars.cpp icu/source/i18n/rbt_pars.cpp
--- icu.old/source/i18n/rbt_pars.cpp 2017-02-01 01:21:27.000000000 +0530
+++ icu/source/i18n/rbt_pars.cpp 2018-09-23 18:52:51.362679180 +0530
@@ -557,6 +557,7 @@
// The next character MUST be a segment open
if (single == NULL ||
!ICU_Utility::parseChar(rule, iref, SEGMENT_OPEN)) {
+ uprv_free(single);
return syntaxError(U_INVALID_FUNCTION, rule, start, status);
}
diff -urN icu.old/source/i18n/tznames_impl.cpp icu/source/i18n/tznames_impl.cpp
--- icu.old/source/i18n/tznames_impl.cpp 2017-10-11 21:54:34.000000000 +0530
+++ icu/source/i18n/tznames_impl.cpp 2018-09-23 18:55:36.222152997 +0530
@@ -1762,6 +1762,7 @@
UResourceBundle* rbTable = NULL;
rbTable = ures_getByKey(rb, key, rbTable, &status);
if (U_FAILURE(status)) {
+ uprv_free(rbTable);
return NULL;
}
@@ -1784,6 +1785,7 @@
if (names != NULL) {
uprv_free(names);
}
+ uprv_free(rbTable);
return NULL;
}
diff -urN icu.old/source/i18n/usearch.cpp icu/source/i18n/usearch.cpp
--- icu.old/source/i18n/usearch.cpp 2017-02-01 01:21:27.000000000 +0530
+++ icu/source/i18n/usearch.cpp 2018-09-23 18:54:34.752103865 +0530
@@ -222,6 +222,7 @@
int32_t *temp = (int32_t *)allocateMemory(
sizeof(int32_t) * newlength, status);
if (U_FAILURE(*status)) {
+ uprv_free(temp);
return NULL;
}
uprv_memcpy(temp, destination, sizeof(int32_t) * (size_t)offset);
@@ -263,6 +264,7 @@
sizeof(int64_t) * newlength, status);
if (U_FAILURE(*status)) {
+ uprv_free(temp);
return NULL;
}
diff -urN icu.old/source/tools/ctestfw/ctest.c icu/source/tools/ctestfw/ctest.c
--- icu.old/source/tools/ctestfw/ctest.c 2017-02-01 01:21:30.000000000 +0530
+++ icu/source/tools/ctestfw/ctest.c 2018-09-23 18:19:43.612734248 +0530
@@ -803,6 +803,7 @@
}
va_start(ap, pattern);
vlog_err(NULL, pattern, ap);
+ va_end(ap);
}
UBool T_CTEST_EXPORT2
@@ -810,6 +811,7 @@
va_list ap;
va_start(ap, pattern);
return vlog_knownIssue(ticket, pattern, ap);
+ va_end(ap);
}
void T_CTEST_EXPORT2
@@ -843,6 +845,7 @@
}
vlog_err(NULL, pattern, ap); /* no need for prefix in default case */
}
+ va_end(ap);
}
void T_CTEST_EXPORT2
@@ -852,6 +855,7 @@
va_start(ap, pattern);
vlog_info(NULL, pattern, ap);
+ va_end(ap);
}
void T_CTEST_EXPORT2
@@ -861,6 +865,7 @@
va_start(ap, pattern);
vlog_verbose(NULL, pattern, ap);
+ va_end(ap);
}
@@ -882,6 +887,7 @@
} else {
vlog_info("[DATA] ", pattern, ap);
}
+ va_end(ap);
}
diff -urN icu.old/source/tools/gensprep/store.c icu/source/tools/gensprep/store.c
--- icu.old/source/tools/gensprep/store.c 2017-02-08 00:27:35.000000000 +0530
+++ icu/source/tools/gensprep/store.c 2018-09-23 17:42:52.262908882 +0530
@@ -634,7 +634,6 @@
cleanUpData(void) {
uprv_free(mappingData);
utrie_close(sprepTrie);
- uprv_free(sprepTrie);
}
#endif /* #if !UCONFIG_NO_IDNA */
diff -urN icu.old/source/tools/pkgdata/pkgdata.cpp icu/source/tools/pkgdata/pkgdata.cpp
--- icu.old/source/tools/pkgdata/pkgdata.cpp 2017-03-23 04:56:34.000000000 +0530
+++ icu/source/tools/pkgdata/pkgdata.cpp 2018-09-23 17:40:19.730240502 +0530
@@ -1531,11 +1531,11 @@
gencFilePath);
result = runCommand(cmd);
- uprv_free(cmd);
if (result != 0) {
fprintf(stderr, "Error creating with assembly code. Failed command: %s\n", cmd);
return result;
}
+ uprv_free(cmd);
return pkg_generateLibraryFile(targetDir, mode, tempObjectFile);
}
diff -urN icu.old/source/tools/toolutil/filetools.cpp icu/source/tools/toolutil/filetools.cpp
--- icu.old/source/tools/toolutil/filetools.cpp 2017-02-01 01:21:30.000000000 +0530
+++ icu/source/tools/toolutil/filetools.cpp 2018-09-23 16:09:47.949491516 +0530
@@ -64,6 +64,7 @@
newpath.append(dirEntry->d_name, -1, status);
if (U_FAILURE(status)) {
fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, u_errorName(status));
+ free(pDir);
return FALSE;
};