]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
charmap_conversion: Free conversion table on exit
authorSiddhesh Poyarekar <siddhesh@sourceware.org>
Tue, 18 May 2021 03:53:48 +0000 (09:23 +0530)
committerSiddhesh Poyarekar <siddhesh@sourceware.org>
Tue, 18 May 2021 03:55:40 +0000 (09:25 +0530)
The conversion table is allocated using xcalloc but never freed.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
iconv/iconv_charmap.c

index f76b3ce2b10ebc07cfdb80c4796d9356939216b5..e2d53fee3cbfbb7a65116991682d0f891ecd3dfd 100644 (file)
@@ -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;
 }