about summary refs log tree commit diff
path: root/iconv/iconv_charmap.c
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@sourceware.org>2021-05-18 09:23:48 +0530
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2021-05-18 09:25:40 +0530
commitc8c3c5e89a5f6a9d41d244e9803ccaf4250e7e62 (patch)
treef936ec959216503351a549f8910c4144b9d0bdca /iconv/iconv_charmap.c
parenta85cdcdb35ed693d0e6eae63dfaca0cffae12765 (diff)
downloadglibc-c8c3c5e89a5f6a9d41d244e9803ccaf4250e7e62.tar.gz
glibc-c8c3c5e89a5f6a9d41d244e9803ccaf4250e7e62.tar.xz
glibc-c8c3c5e89a5f6a9d41d244e9803ccaf4250e7e62.zip
charmap_conversion: Free conversion table on exit
The conversion table is allocated using xcalloc but never freed.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'iconv/iconv_charmap.c')
-rw-r--r--iconv/iconv_charmap.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/iconv/iconv_charmap.c b/iconv/iconv_charmap.c
index f76b3ce2b1..e2d53fee3c 100644
--- a/iconv/iconv_charmap.c
+++ b/iconv/iconv_charmap.c
@@ -53,6 +53,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 +234,7 @@ charmap_conversion (const char *from_code, struct charmap_t *from_charmap,
     while (++remaining < argc);
 
   /* All done.  */
+  free_table (cvtbl);
   return status;
 }