--- texlive-source (full)/texk/kpathsea/cnf.c
+++ pdftex-root/texk/kpathsea/cnf.c
@@ -236,7 +236,6 @@
       xfclose (cnf_file, *cnf);
       free (*cnf);
     }
-    free (cnf_files);
   } else {
     string warn = getenv ("KPATHSEA_WARNING");
     if (!(warn && STREQ (warn, "0"))) {
@@ -245,6 +244,7 @@
         cnf_path);
     }
   }
+  free (cnf_files);
 }


--- texlive-source (full)/texk/kpathsea/fontmap.c
+++ pdftex-root/texk/kpathsea/fontmap.c
@@ -164,6 +164,7 @@
     map_file_parse (kpse, *filenames);
     filenames++;
   }
+  free(filenames);
 }


--- texlive-source (full)/texk/kpathsea/pathsearch.c
+++ pdftex-root/texk/kpathsea/pathsearch.c
@@ -658,9 +658,11 @@
       if (!STR_LIST_EMPTY (abs_ret_list)) {
         str_list_add (&ret_list, STR_LIST_FIRST_ELT (abs_ret_list));
         if (!all) { /* if they only wanted one, we're done */
+          str_list_free(&abs_ret_list);
           goto out;
         }
       }
+      str_list_free(&abs_ret_list);
     } else {
       all_absolute = false;
     }
--- texlive-source (full)/texk/kpathsea/str-list.c
+++ pdftex-root/texk/kpathsea/str-list.c
@@ -146,7 +146,7 @@
       free (elt1);  /* duplicate, forget this one */
     }
   }
-
+  str_list_free(l);
   /* Replace the passed list with what we constructed.  */
   *l = ret;
 }
--- texlive-source (full)/texk/kpathsea/tex-file.h
+++ pdftex-root/texk/kpathsea/tex-file.h
@@ -63,7 +63,7 @@
 /* Like kpathsea_init_format, but return the list of (environment/config)
    variable names considered, which is not otherwise saved.  This is
    only used by kpsewhich --help.  */
-extern KPSEDLL const_string kpathsea_init_format_return_varlist (kpathsea kpse,
+extern KPSEDLL string kpathsea_init_format_return_varlist (kpathsea kpse,
   kpse_file_format_type format);
 
 /* If FORMAT has a non-null `suffix' member, append it to NAME "."
--- texlive-source (full)/texk/kpathsea/expand.c
+++ pdftex-root/texk/kpathsea/expand.c
@@ -310,6 +310,8 @@
     new_string[len]=0;
     str_list_add(&tmp, new_string);
     str_list_concat_elements(partial, tmp);
+    str_list_free(&tmp);
+    free(new_string);
 }
 
 
@@ -333,6 +335,9 @@
             ++p;
             recurse = brace_expand(kpse, &p);
             str_list_concat_elements(&partial, recurse);
+            for (int i = 0; i != STR_LIST_LENGTH(recurse); ++i) {
+                free(STR_LIST_ELT(recurse,i));
+            }
             str_list_free(&recurse);
             /* Check for missing closing brace. */
             if (*p != '}') {

--- texlive-source (full)/texk/kpathsea/tex-file.c
+++ pdftex-root/texk/kpathsea/tex-file.c
@@ -504,7 +504,7 @@
   /* If we get called twice, don't redo all the work.  */
   if (! FMT_INFO.path) {
     /* Don't care about the list of variable names.  */
-    (void) kpathsea_init_format_return_varlist (kpse, format);
+    free(kpathsea_init_format_return_varlist (kpse, format));
   }
   
   return FMT_INFO.path;
@@ -515,7 +515,7 @@
    saved.  Although in principle we could add that list to our format
    struct, it seems a waste, since this is only used by kpsewhich --help.  */
 
-const_string
+string
 kpathsea_init_format_return_varlist(kpathsea kpse,kpse_file_format_type format)
 {
   string envvar_list;  /* only for debug output, set in INIT_FORMAT */
@@ -1124,6 +1123,7 @@
       target[count++] = xstrdup (name);
     }
     target[count] = NULL;
+    free(ret);
     ret = kpathsea_path_search_list_generic (kpse, FMT_INFO.path,
                                              target, true, all);
   }
@@ -1136,6 +1136,7 @@
   /* If nothing was found, call mktex* to create a missing file.  Since
      this returns a single string, morph it into a list.  */
   if (! *ret && must_exist) {
+    free(ret);
     ret = XTALLOC (2, string);
     ret[0] = kpathsea_make_tex (kpse, format, name);
     if (ret[0]) {

