a588c1
diff -ru icu.orig/source/common/serv.cpp icu/source/common/serv.cpp
a588c1
--- icu.orig/source/common/serv.cpp	2020-04-22 22:04:20.000000000 +0200
a588c1
+++ icu/source/common/serv.cpp	2021-08-18 13:04:50.838841089 +0200
a588c1
@@ -532,12 +532,14 @@
a588c1
             }
a588c1
             UnicodeString* idToCache = new UnicodeString(currentDescriptor);
a588c1
             if (idToCache == NULL || idToCache->isBogus()) {
a588c1
+                delete idToCache;
a588c1
                 status = U_MEMORY_ALLOCATION_ERROR;
a588c1
                 return NULL;
a588c1
             }
a588c1
 
a588c1
             cacheDescriptorList._obj->addElement(idToCache, status);
a588c1
             if (U_FAILURE(status)) {
a588c1
+                // delete idToCache;
a588c1
                 return NULL;
a588c1
             }
a588c1
         } while (key.fallback());
a588c1
diff -ru icu.orig/source/common/uloc_keytype.cpp icu/source/common/uloc_keytype.cpp
a588c1
--- icu.orig/source/common/uloc_keytype.cpp	2020-04-22 22:04:20.000000000 +0200
a588c1
+++ icu/source/common/uloc_keytype.cpp	2021-08-18 14:03:41.707324553 +0200
a588c1
@@ -331,6 +331,10 @@
a588c1
         LocExtKeyData* keyData = gLocExtKeyDataEntries->create();
a588c1
         if (keyData == NULL) {
a588c1
             sts = U_MEMORY_ALLOCATION_ERROR;
a588c1
+            if (typeDataMap != NULL) {
a588c1
+                uhash_close(typeDataMap);
a588c1
+                typeDataMap = NULL;
a588c1
+            }
a588c1
             break;
a588c1
         }
a588c1
         keyData->bcpId = bcpKeyId;
a588c1
diff -ru icu.orig/source/common/umutablecptrie.cpp icu/source/common/umutablecptrie.cpp
a588c1
--- icu.orig/source/common/umutablecptrie.cpp	2020-04-22 22:04:20.000000000 +0200
a588c1
+++ icu/source/common/umutablecptrie.cpp	2021-08-18 13:59:02.507170287 +0200
a588c1
@@ -1543,7 +1543,7 @@
a588c1
     MixedBlocks mixedBlocks;
a588c1
     int32_t newDataLength = compactData(fastILimit, newData, newDataCapacity,
a588c1
                                         dataNullIndex, mixedBlocks, errorCode);
a588c1
-    if (U_FAILURE(errorCode)) { return 0; }
a588c1
+    if (U_FAILURE(errorCode)) { uprv_free(newData); return 0; }
a588c1
     U_ASSERT(newDataLength <= newDataCapacity);
a588c1
     uprv_free(data);
a588c1
     data = newData;
a588c1
diff -ru icu.orig/source/i18n/rbt_pars.cpp icu/source/i18n/rbt_pars.cpp
a588c1
--- icu.orig/source/i18n/rbt_pars.cpp	2020-04-22 22:04:20.000000000 +0200
a588c1
+++ icu/source/i18n/rbt_pars.cpp	2021-08-18 16:03:45.537119292 +0200
a588c1
@@ -557,6 +557,7 @@
a588c1
                 // The next character MUST be a segment open
a588c1
                 if (single == NULL ||
a588c1
                     !ICU_Utility::parseChar(rule, iref, SEGMENT_OPEN)) {
a588c1
+                    delete single;
a588c1
                     return syntaxError(U_INVALID_FUNCTION, rule, start, status);
a588c1
                 }
a588c1
                 
a588c1
diff -ru icu.orig/source/i18n/tridpars.cpp icu/source/i18n/tridpars.cpp
a588c1
--- icu.orig/source/i18n/tridpars.cpp	2020-04-22 22:04:20.000000000 +0200
a588c1
+++ icu/source/i18n/tridpars.cpp	2021-08-18 16:08:57.727071891 +0200
a588c1
@@ -136,6 +136,9 @@
a588c1
                 specsB = parseFilterID(id, pos, TRUE);
a588c1
                 // Must close with a ')'
a588c1
                 if (specsB == NULL || !ICU_Utility::parseChar(id, pos, CLOSE_REV)) {
a588c1
+                    if (specsB != NULL) {
a588c1
+                        delete specsB;
a588c1
+                    }
a588c1
                     delete specsA;
a588c1
                     pos = start;
a588c1
                     return NULL;
a588c1
diff -ru icu.orig/source/i18n/usearch.cpp icu/source/i18n/usearch.cpp
a588c1
--- icu.orig/source/i18n/usearch.cpp	2020-04-22 22:04:20.000000000 +0200
a588c1
+++ icu/source/i18n/usearch.cpp	2021-08-18 16:19:31.533900708 +0200
a588c1
@@ -222,6 +222,9 @@
a588c1
         int32_t *temp = (int32_t *)allocateMemory(
a588c1
                                          sizeof(int32_t) * newlength, status);
a588c1
         if (U_FAILURE(*status)) {
a588c1
+            if (temp != NULL) {
a588c1
+                uprv_free(temp);
a588c1
+            }
a588c1
             return NULL;
a588c1
         }
a588c1
         uprv_memcpy(temp, destination, sizeof(int32_t) * (size_t)offset);
a588c1
diff -ru icu.orig/source/i18n/usearch.cpp icu/source/i18n/usearch.cpp
a588c1
--- icu.orig/source/i18n/usearch.cpp	2021-08-18 16:23:27.961337248 +0200
a588c1
+++ icu/source/i18n/usearch.cpp	2021-08-18 16:27:47.140623351 +0200
a588c1
@@ -266,6 +266,9 @@
a588c1
                                          sizeof(int64_t) * newlength, status);
a588c1
 
a588c1
         if (U_FAILURE(*status)) {
a588c1
+            if (temp != NULL) {
a588c1
+                uprv_free(temp);
a588c1
+            }
a588c1
             return NULL;
a588c1
         }
a588c1
 
a588c1
diff -ru icu.orig/source/i18n/uspoof_impl.cpp icu/source/i18n/uspoof_impl.cpp
a588c1
--- icu.orig/source/i18n/uspoof_impl.cpp	2020-04-22 22:04:20.000000000 +0200
a588c1
+++ icu/source/i18n/uspoof_impl.cpp	2021-08-18 16:30:43.061460025 +0200
a588c1
@@ -196,6 +196,9 @@
a588c1
     tmpSet = allowedChars.clone();
a588c1
     const char *tmpLocalesList = uprv_strdup(localesList);
a588c1
     if (tmpSet == NULL || tmpLocalesList == NULL) {
a588c1
+        if (tmpLocalesList != NULL) {
a588c1
+            uprv_free((void *)tmpLocalesList);
a588c1
+        }
a588c1
         status = U_MEMORY_ALLOCATION_ERROR;
a588c1
         return;
a588c1
     }
a588c1
diff -ru icu.orig/source/common/loclikely.cpp icu/source/common/loclikely.cpp
a588c1
--- icu.orig/source/common/loclikely.cpp	2020-04-22 22:04:20.000000000 +0200
a588c1
+++ icu/source/common/loclikely.cpp	2021-08-18 16:59:05.786257032 +0200
a588c1
@@ -1351,7 +1351,9 @@
a588c1
         }
a588c1
     }
a588c1
 
a588c1
-    rgBuf[rgLen] = 0;
a588c1
+    if (rgLen >= 0) {
a588c1
+        rgBuf[rgLen] = 0;
a588c1
+    }
a588c1
     uprv_strncpy(region, rgBuf, regionCapacity);
a588c1
     return u_terminateChars(region, regionCapacity, rgLen, status);
a588c1
 }
a588c1
diff -ru icu.orig/source/common/lsr.cpp icu/source/common/lsr.cpp
a588c1
--- icu.orig/source/common/lsr.cpp	2020-04-22 22:04:20.000000000 +0200
a588c1
+++ icu/source/common/lsr.cpp	2021-08-18 17:39:36.706794880 +0200
a588c1
@@ -89,13 +89,15 @@
a588c1
         int32_t b = region[1] - '0';
a588c1
         if (b < 0 || 9 < b) { return 0; }
a588c1
         c = region[2] - '0';
a588c1
-        if (c < 0 || 9 < c || region[3] != 0) { return 0; }
a588c1
+        if (uprv_strlen(region) > 3) { return 0; }
a588c1
+        if (c < 0 || 9 < c) { return 0; }
a588c1
         return (10 * a + b) * 10 + c + 1;
a588c1
     } else {  // letters: "DE"
a588c1
         a = uprv_upperOrdinal(c);
a588c1
         if (a < 0 || 25 < a) { return 0; }
a588c1
         int32_t b = uprv_upperOrdinal(region[1]);
a588c1
-        if (b < 0 || 25 < b || region[2] != 0) { return 0; }
a588c1
+        if (uprv_strlen(region) > 2) { return 0; }
a588c1
+        if (b < 0 || 25 < b) { return 0; }
a588c1
         return 26 * a + b + 1001;
a588c1
     }
a588c1
     return 0;
a588c1
diff -ru icu.orig/source/tools/toolutil/filetools.cpp icu/source/tools/toolutil/filetools.cpp
a588c1
--- icu.orig/source/tools/toolutil/filetools.cpp	2020-04-22 22:04:20.000000000 +0200
a588c1
+++ icu/source/tools/toolutil/filetools.cpp	2021-08-19 09:56:56.393333089 +0200
a588c1
@@ -64,6 +64,7 @@
a588c1
                     newpath.append(dirEntry->d_name, -1, status);
a588c1
                     if (U_FAILURE(status)) {
a588c1
                         fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, u_errorName(status));
a588c1
+                        closedir(pDir);
a588c1
                         return FALSE;
a588c1
                     }
a588c1
 
a588c1
a588c1
diff -ru icu.orig/source/tools/pkgdata/pkgtypes.c icu/source/tools/pkgdata/pkgtypes.c
a588c1
--- icu.orig/source/tools/pkgdata/pkgtypes.c	2020-04-22 22:04:20.000000000 +0200
a588c1
+++ icu/source/tools/pkgdata/pkgtypes.c	2021-08-19 10:37:07.400622046 +0200
a588c1
@@ -30,6 +30,7 @@
a588c1
 {
a588c1
     int32_t ln = 0;
a588c1
     char buffer[1024];
a588c1
+    char *bufferp = buffer;
a588c1
     while(l != NULL)
a588c1
     {
a588c1
         if(l->str)
a588c1
@@ -42,7 +43,7 @@
a588c1
                     buffer[uprv_strlen(buffer)-1] = '\0';
a588c1
                 }
a588c1
                 if(buffer[0] == '"') {
a588c1
-                    uprv_strcpy(buffer, buffer+1);
a588c1
+                    bufferp = buffer+1;
a588c1
                 }
a588c1
             } else if(quote > 0) { /* add quotes */
a588c1
                 if(l->str[0] != '"') {
a588c1
@@ -53,7 +54,7 @@
a588c1
                     uprv_strcat(buffer, "\"");
a588c1
                 }
a588c1
             }
a588c1
-            T_FileStream_write(s, buffer, (int32_t)uprv_strlen(buffer));
a588c1
+            T_FileStream_write(s, bufferp, (int32_t)uprv_strlen(bufferp));
a588c1
 
a588c1
             ln += (int32_t)uprv_strlen(l->str);
a588c1
         }
a588c1
@@ -74,7 +75,8 @@
a588c1
 
a588c1
 const char *pkg_writeCharList(FileStream *s, CharList *l, const char *delim, int32_t quote)
a588c1
 {
a588c1
-    char buffer[1024];
a588c1
+    char buffer[1026]; /* 1026 instead of 1024 because quotes may be added */
a588c1
+    char *bufferp = buffer;
a588c1
     while(l != NULL)
a588c1
     {
a588c1
         if(l->str)
a588c1
@@ -92,7 +94,7 @@
a588c1
                     buffer[uprv_strlen(buffer)-1] = '\0';
a588c1
                 }
a588c1
                 if(buffer[0] == '"') {
a588c1
-                    uprv_strcpy(buffer, buffer+1);
a588c1
+                    bufferp = buffer+1;
a588c1
                 }
a588c1
             } else if(quote > 0) { /* add quotes */
a588c1
                 if(l->str[0] != '"') {
a588c1
@@ -103,7 +105,7 @@
a588c1
                     uprv_strcat(buffer, "\"");
a588c1
                 }
a588c1
             }
a588c1
-            T_FileStream_write(s, buffer, (int32_t)uprv_strlen(buffer));
a588c1
+            T_FileStream_write(s, bufferp, (int32_t)uprv_strlen(bufferp));
a588c1
         }
a588c1
 
a588c1
         if(l->next && delim)
a588c1
diff -ru icu.orig/source/tools/pkgdata/pkgdata.cpp icu/source/tools/pkgdata/pkgdata.cpp
a588c1
--- icu.orig/source/tools/pkgdata/pkgdata.cpp	2020-04-22 22:04:20.000000000 +0200
a588c1
+++ icu/source/tools/pkgdata/pkgdata.cpp	2021-08-19 11:11:35.563339463 +0200
a588c1
@@ -980,12 +980,12 @@
a588c1
                     version_major);
a588c1
 #else
a588c1
         if (noVersion && !reverseExt) {
a588c1
-            sprintf(libFileNames[LIB_FILE_VERSION_TMP], "%s%s%s",
a588c1
+            snprintf(libFileNames[LIB_FILE_VERSION_TMP], sizeof(libFileNames[LIB_FILE_VERSION_TMP]), "%s%s%s",
a588c1
                     libFileNames[LIB_FILE],
a588c1
                     FILE_SUFFIX,
a588c1
                     pkgDataFlags[SOBJ_EXT]);
a588c1
         } else {
a588c1
-            sprintf(libFileNames[LIB_FILE_VERSION_TMP], "%s%s%s%s%s",
a588c1
+            snprintf(libFileNames[LIB_FILE_VERSION_TMP], sizeof(libFileNames[LIB_FILE_VERSION_TMP]), "%s%s%s%s%s",
a588c1
                     libFileNames[LIB_FILE],
a588c1
                     FILE_SUFFIX,
a588c1
                     reverseExt ? version : pkgDataFlags[SOBJ_EXT],
a588c1
@@ -994,24 +994,24 @@
a588c1
         }
a588c1
 #endif
a588c1
         if (noVersion && !reverseExt) {
a588c1
-            sprintf(libFileNames[LIB_FILE_VERSION_MAJOR], "%s%s%s",
a588c1
+            snprintf(libFileNames[LIB_FILE_VERSION_MAJOR], sizeof(libFileNames[LIB_FILE_VERSION_MAJOR]), "%s%s%s",
a588c1
                     libFileNames[LIB_FILE],
a588c1
                     FILE_SUFFIX,
a588c1
                     pkgDataFlags[SO_EXT]);
a588c1
 
a588c1
-            sprintf(libFileNames[LIB_FILE_VERSION], "%s%s%s",
a588c1
+            snprintf(libFileNames[LIB_FILE_VERSION], sizeof(libFileNames[LIB_FILE_VERSION]), "%s%s%s",
a588c1
                     libFileNames[LIB_FILE],
a588c1
                     FILE_SUFFIX,
a588c1
                     pkgDataFlags[SO_EXT]);
a588c1
         } else {
a588c1
-            sprintf(libFileNames[LIB_FILE_VERSION_MAJOR], "%s%s%s%s%s",
a588c1
+            snprintf(libFileNames[LIB_FILE_VERSION_MAJOR], sizeof(libFileNames[LIB_FILE_VERSION_MAJOR]), "%s%s%s%s%s",
a588c1
                     libFileNames[LIB_FILE],
a588c1
                     FILE_SUFFIX,
a588c1
                     reverseExt ? version_major : pkgDataFlags[SO_EXT],
a588c1
                     FILE_EXTENSION_SEP,
a588c1
                     reverseExt ? pkgDataFlags[SO_EXT] : version_major);
a588c1
 
a588c1
-            sprintf(libFileNames[LIB_FILE_VERSION], "%s%s%s%s%s",
a588c1
+            snprintf(libFileNames[LIB_FILE_VERSION], sizeof(libFileNames[LIB_FILE_VERSION]), "%s%s%s%s%s",
a588c1
                     libFileNames[LIB_FILE],
a588c1
                     FILE_SUFFIX,
a588c1
                     reverseExt ? version : pkgDataFlags[SO_EXT],
a588c1
@@ -1029,7 +1029,7 @@
a588c1
 #endif
a588c1
 
a588c1
         if(IN_STATIC_MODE(mode)) {
a588c1
-            sprintf(libFileNames[LIB_FILE_VERSION], "%s.%s", libFileNames[LIB_FILE], pkgDataFlags[A_EXT]);
a588c1
+            snprintf(libFileNames[LIB_FILE_VERSION], sizeof(libFileNames[LIB_FILE_VERSION]), "%s.%s", libFileNames[LIB_FILE], pkgDataFlags[A_EXT]);
a588c1
             libFileNames[LIB_FILE_VERSION_MAJOR][0]=0;
a588c1
             if(o->verbose) {
a588c1
               fprintf(stdout, "# libFileName[LIB_FILE_VERSION] = %s  (static)\n", libFileNames[LIB_FILE_VERSION]);
a588c1
@@ -1308,7 +1308,7 @@
a588c1
      * archive file suffix is the same, then the final library needs to be archived.
a588c1
      */
a588c1
     if (uprv_strcmp(pkgDataFlags[SOBJ_EXT], pkgDataFlags[SO_EXT]) != 0 && uprv_strcmp(pkgDataFlags[A_EXT], pkgDataFlags[SO_EXT]) == 0) {
a588c1
-        sprintf(libFileNames[LIB_FILE_VERSION], "%s%s%s.%s",
a588c1
+        snprintf(libFileNames[LIB_FILE_VERSION], sizeof(libFileNames[LIB_FILE_VERSION]), "%s%s%s.%s",
a588c1
                 libFileNames[LIB_FILE],
a588c1
                 pkgDataFlags[LIB_EXT_ORDER][0] == '.' ? "." : "",
a588c1
                 reverseExt ? version : pkgDataFlags[SO_EXT],
a588c1
diff -ru icu.orig/source/tools/ctestfw/ctest.c icu/source/tools/ctestfw/ctest.c
a588c1
--- icu.orig/source/tools/ctestfw/ctest.c	2020-04-22 22:04:20.000000000 +0200
a588c1
+++ icu/source/tools/ctestfw/ctest.c	2021-08-19 13:19:21.016799737 +0200
a588c1
@@ -686,7 +686,6 @@
a588c1
     }
a588c1
     vfprintf(stdout, pattern, ap);
a588c1
     fflush(stdout);
a588c1
-    va_end(ap);
a588c1
     if((*pattern==0) || (pattern[strlen(pattern)-1]!='\n')) {
a588c1
     	HANGING_OUTPUT=1;
a588c1
     } else {
a588c1
@@ -728,7 +727,6 @@
a588c1
     }
a588c1
     vfprintf(stdout, pattern, ap);
a588c1
     fflush(stdout);
a588c1
-    va_end(ap);
a588c1
     if((*pattern==0) || (pattern[strlen(pattern)-1]!='\n')) {
a588c1
     	HANGING_OUTPUT=1;
a588c1
     } else {
a588c1
@@ -777,7 +775,6 @@
a588c1
     }
a588c1
     vfprintf(stdout, pattern, ap);
a588c1
     fflush(stdout);
a588c1
-    va_end(ap);
a588c1
     GLOBAL_PRINT_COUNT++;
a588c1
     if((*pattern==0) || (pattern[strlen(pattern)-1]!='\n')) {
a588c1
     	HANGING_OUTPUT=1;
a588c1
@@ -803,6 +800,7 @@
a588c1
     }
a588c1
     va_start(ap, pattern);
a588c1
     vlog_err(NULL, pattern, ap);
a588c1
+    va_end(ap);
a588c1
 }
a588c1
 
a588c1
 UBool T_CTEST_EXPORT2
a588c1
@@ -806,8 +806,11 @@
a588c1
 UBool T_CTEST_EXPORT2
a588c1
 log_knownIssue(const char *ticket, const char *pattern, ...) {
a588c1
   va_list ap;
a588c1
+  UBool result;
a588c1
   va_start(ap, pattern);
a588c1
-  return vlog_knownIssue(ticket, pattern, ap);
a588c1
+  result =  vlog_knownIssue(ticket, pattern, ap);
a588c1
+  va_end(ap);
a588c1
+  return result;
a588c1
 }
a588c1
 
a588c1
 void T_CTEST_EXPORT2
a588c1
@@ -843,6 +842,7 @@
a588c1
         }
a588c1
         vlog_err(NULL, pattern, ap); /* no need for prefix in default case */
a588c1
     }
a588c1
+    va_end(ap);
a588c1
 }
a588c1
 
a588c1
 void T_CTEST_EXPORT2
a588c1
@@ -852,6 +852,7 @@
a588c1
 
a588c1
     va_start(ap, pattern);
a588c1
     vlog_info(NULL, pattern, ap);
a588c1
+    va_end(ap);
a588c1
 }
a588c1
 
a588c1
 void T_CTEST_EXPORT2
a588c1
@@ -861,6 +862,7 @@
a588c1
 
a588c1
     va_start(ap, pattern);
a588c1
     vlog_verbose(NULL, pattern, ap);
a588c1
+    va_end(ap);
a588c1
 }
a588c1
 
a588c1
 
a588c1
@@ -882,6 +884,7 @@
a588c1
     } else {
a588c1
         vlog_info("[DATA] ", pattern, ap); 
a588c1
     }
a588c1
+    va_end(ap);
a588c1
 }
a588c1
 
a588c1
 
a588c1
diff -ru icu/source/tools/gensprep/store.c icu.new/source/tools/gensprep/store.c
a588c1
--- icu/source/tools/gensprep/store.c	2020-04-22 22:04:20.000000000 +0200
a588c1
+++ icu.new/source/tools/gensprep/store.c	2021-08-19 16:16:17.213687755 +0200
a588c1
@@ -636,7 +636,6 @@
a588c1
 cleanUpData(void) {
a588c1
     uprv_free(mappingData);
a588c1
     utrie_close(sprepTrie);
a588c1
-    uprv_free(sprepTrie);
a588c1
 }
a588c1
 
a588c1
 #endif /* #if !UCONFIG_NO_IDNA */
a588c1
diff -ru icu.orig/source/common/uloc_tag.cpp icu/source/common/uloc_tag.cpp
a588c1
--- icu.orig/source/common/uloc_tag.cpp	2020-04-22 22:04:20.000000000 +0200
a588c1
+++ icu/source/common/uloc_tag.cpp	2021-08-19 16:32:26.948185554 +0200
a588c1
@@ -2254,6 +2254,7 @@
a588c1
                 var = (VariantListEntry*)uprv_malloc(sizeof(VariantListEntry));
a588c1
                 if (var == NULL) {
a588c1
                     *status = U_MEMORY_ALLOCATION_ERROR;
a588c1
+                    uprv_free(pExtension);
a588c1
                     return NULL;
a588c1
                 }
a588c1
                 *pSep = 0;
a588c1
diff -ru icu.orig/source/common/uloc_keytype.cpp icu/source/common/uloc_keytype.cpp
a588c1
--- icu.orig/source/common/uloc_keytype.cpp	2021-08-19 16:34:07.037514442 +0200
a588c1
+++ icu/source/common/uloc_keytype.cpp	2021-08-19 16:37:38.276098078 +0200
a588c1
@@ -325,6 +325,10 @@
a588c1
             }
a588c1
         }
a588c1
         if (U_FAILURE(sts)) {
a588c1
+            if (typeDataMap != NULL) {
a588c1
+                uhash_close(typeDataMap);
a588c1
+                typeDataMap = NULL;
a588c1
+            }
a588c1
             break;
a588c1
         }
a588c1
 
a588c1
diff -ru icu.orig/source/common/serv.cpp icu/source/common/serv.cpp
a588c1
--- icu.orig/source/common/serv.cpp	2021-08-19 20:45:49.923742619 +0200
a588c1
+++ icu/source/common/serv.cpp	2021-08-20 13:16:04.401298668 +0200
a588c1
@@ -793,6 +793,7 @@
a588c1
      */
a588c1
     int32_t pos = UHASH_FIRST; 
a588c1
     const UHashElement *entry = NULL;
a588c1
+    /* coverity[deref_after_free] */
a588c1
     while ((entry = dnCache->cache.nextElement(pos)) != NULL) {
a588c1
         const UnicodeString* id = (const UnicodeString*)entry->value.pointer;
a588c1
         if (matchKey != NULL && !matchKey->isFallbackOf(*id)) {
a588c1
diff -ru icu.orig/source/i18n/decNumber.h icu/source/i18n/decNumber.h
a588c1
--- icu.orig/source/i18n/decNumber.h	2020-04-22 22:04:20.000000000 +0200
a588c1
+++ icu/source/i18n/decNumber.h	2021-08-20 13:17:27.208783404 +0200
a588c1
@@ -86,7 +86,7 @@
a588c1
                          /* range: -1999999997 through 999999999      */
a588c1
     uint8_t bits;        /* Indicator bits (see above)                */
a588c1
                          /* Coefficient, from least significant unit  */
a588c1
-    decNumberUnit lsu[DECNUMUNITS];
a588c1
+    decNumberUnit lsu[DECNUMUNITS+2];
a588c1
     } decNumber;
a588c1
 
a588c1
   /* Notes:                                                           */
a588c1
diff -ru icu.orig/source/tools/makeconv/genmbcs.cpp icu/source/tools/makeconv/genmbcs.cpp
a588c1
--- icu.orig/source/tools/makeconv/genmbcs.cpp	2020-04-22 22:04:20.000000000 +0200
a588c1
+++ icu/source/tools/makeconv/genmbcs.cpp	2021-08-23 08:07:02.972087418 +0200
a588c1
@@ -172,7 +172,7 @@
a588c1
     }
a588c1
 
a588c1
     MBCSInit(mbcsData, ucm);
a588c1
-    return &mbcsData->newConverter;
a588c1
+    return (NewConverter *)mbcsData;
a588c1
 }
a588c1
 
a588c1
 static void
a588c1
diff -ru icu.orig/source/common/brkiter.cpp icu/source/common/brkiter.cpp
a588c1
--- icu.orig/source/common/brkiter.cpp	2020-04-22 22:04:20.000000000 +0200
a588c1
+++ icu/source/common/brkiter.cpp	2021-08-23 13:56:11.644603960 +0200
a588c1
@@ -105,7 +105,9 @@
a588c1
         }
a588c1
     }
a588c1
 
a588c1
+    /* coverity[incorrect_free] */
a588c1
     ures_close(brkRules);
a588c1
+    /* coverity[incorrect_free] */
a588c1
     ures_close(brkName);
a588c1
 
a588c1
     UDataMemory* file = udata_open(U_ICUDATA_BRKITR, ext, fnbuff, &status);
a588c1
diff -ru icu.orig/source/common/uresbund.cpp icu/source/common/uresbund.cpp
a588c1
--- icu.orig/source/common/uresbund.cpp	2020-04-22 22:04:20.000000000 +0200
a588c1
+++ icu/source/common/uresbund.cpp	2021-08-23 13:56:53.329339657 +0200
a588c1
@@ -2493,7 +2493,9 @@
a588c1
 static void U_CALLCONV
a588c1
 ures_loc_closeLocales(UEnumeration *enumerator) {
a588c1
     ULocalesContext *ctx = (ULocalesContext *)enumerator->context;
a588c1
+    /* coverity[address_free] */
a588c1
     ures_close(&ctx->curr);
a588c1
+    /* coverity[address_free] */
a588c1
     ures_close(&ctx->installed);
a588c1
     uprv_free(ctx);
a588c1
     uprv_free(enumerator);