packaging: Enable memcpy in sysdeps/arm/memcpy.S for ARM
[platform/upstream/glibc.git] / iconv / iconv_charmap.c
index 999d21b..b36cf7e 100644 (file)
@@ -1,7 +1,6 @@
 /* Convert using charmaps and possibly iconv().
-   Copyright (C) 2001-2016 Free Software Foundation, Inc.
+   Copyright (C) 2001-2024 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published
@@ -14,7 +13,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
 
 #include <assert.h>
 #include <errno.h>
@@ -53,6 +52,12 @@ allocate_table (void)
   return (struct convtable *) xcalloc (1, sizeof (struct convtable));
 }
 
+static inline void
+free_table (struct convtable *tbl)
+{
+  free (tbl);
+}
+
 
 static inline int
 is_term (struct convtable *tbl, unsigned int idx)
@@ -228,6 +233,9 @@ charmap_conversion (const char *from_code, struct charmap_t *from_charmap,
     while (++remaining < argc);
 
   /* All done.  */
+  if (output != stdout)
+    fclose (output);
+  free_table (cvtbl);
   return status;
 }
 
@@ -432,7 +440,7 @@ process_block (struct convtable *tbl, char *addr, size_t len, FILE *output)
               ignoring errors.  Otherwise punt.  */
            if (! omit_invalid)
              {
-               error (0, 0, _("illegal input sequence at position %Zd"), n);
+               error (0, 0, _("illegal input sequence at position %zd"), n);
                return -1;
              }