]> granicus.if.org Git - icu/commitdiff
ICU-11547 Locale::getBaseName(), use uprv_strdup() (review comment).
authorAndy Heninger <andy.heninger@gmail.com>
Thu, 5 Mar 2015 00:51:11 +0000 (00:51 +0000)
committerAndy Heninger <andy.heninger@gmail.com>
Thu, 5 Mar 2015 00:51:11 +0000 (00:51 +0000)
X-SVN-Rev: 37138

icu4c/source/common/locid.cpp

index fe7ead27c3c552be337c0baddc71c8a45ac47f1a..27e403065f2e933c99c215e6d2de93f856c5981f 100644 (file)
@@ -446,10 +446,7 @@ Locale &Locale::operator=(const Locale &other)
         baseName = fullName;
     } else {
         if (other.baseName) {
-            baseName = (char *)uprv_malloc(uprv_strlen(other.baseName)+1);
-            if (baseName) {
-                uprv_strcpy(baseName, other.baseName);
-            }
+            baseName = uprv_strdup(other.baseName);
         }
     }