]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/extra/uconv/uconv.cpp
ICU-400.37.tar.gz
[apple/icu.git] / icuSources / extra / uconv / uconv.cpp
index a743daf0df319e6fc4969a60e82e49678d3f5656..b033afec7e7d8e6a4988326716aa14c1382bcd43 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
 *
-*   Copyright (C) 1999-2006, International Business Machines
+*   Copyright (C) 1999-2008, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *
 ******************************************************************************/
@@ -38,6 +38,8 @@
 
 #include "unicode/uwmsg.h"
 
+U_NAMESPACE_USE
+
 #if (defined(U_WINDOWS) || defined(U_CYGWIN)) && !defined(__STRICT_ANSI__)
 #include <io.h>
 #include <fcntl.h>
@@ -257,7 +259,7 @@ static int printConverters(const char *pname, const char *lookfor,
             }
             if (U_FAILURE(err)) {
                 u_wmsg(stderr, "cantGetTag", u_wmsg_errorName(err));
-                return -1;
+                goto error_cleanup;
             }
         }
         if (canon) {
@@ -289,7 +291,7 @@ static int printConverters(const char *pname, const char *lookfor,
             putchar('\t');
             u_wmsg(stderr, "cantGetAliases", str.getTerminatedBuffer(),
                 u_wmsg_errorName(err));
-            return -1;
+            goto error_cleanup;
         } else {
             uint16_t a, s, t;
 
@@ -303,7 +305,7 @@ static int printConverters(const char *pname, const char *lookfor,
                     putchar('\t');
                     u_wmsg(stderr, "cantGetAliases", str.getTerminatedBuffer(),
                         u_wmsg_errorName(err));
-                    return -1;
+                    goto error_cleanup;
                 }
 
                 /* Print the current alias so that it looks right. */
@@ -361,6 +363,9 @@ static int printConverters(const char *pname, const char *lookfor,
     /* Success. */
 
     return 0;
+error_cleanup:
+    uprv_free(stds);
+    return -1;
 }
 
 /* Print all available transliterators. If canon is non zero, print