Blame SOURCES/texlive-20180414-covscan.patch

fcfc58
diff -up texlive-20180414/source/libs/luajit/LuaJIT-src/src/host/minilua.c.me texlive-20180414/source/libs/luajit/LuaJIT-src/src/host/minilua.c
fcfc58
--- texlive-20180414/source/libs/luajit/LuaJIT-src/src/host/minilua.c.me	2018-08-14 10:08:29.573912544 +0100
fcfc58
+++ texlive-20180414/source/libs/luajit/LuaJIT-src/src/host/minilua.c	2018-09-24 09:18:24.640331882 +0100
fcfc58
@@ -4327,7 +4327,7 @@ if(lh->v.u.s.info==v->u.s.info){
fcfc58
 conflict=1;
fcfc58
 lh->v.u.s.info=extra;
fcfc58
 }
fcfc58
-if(lh->v.u.s.aux==v->u.s.info){
fcfc58
+if(lh->v.u.s.aux==v->u.s.aux){
fcfc58
 conflict=1;
fcfc58
 lh->v.u.s.aux=extra;
fcfc58
 }
fcfc58
diff -up texlive-20180414/source/libs/zziplib/zziplib-src/docs/make-doc.py.me texlive-20180414/source/libs/zziplib/zziplib-src/docs/make-doc.py
fcfc58
--- texlive-20180414/source/libs/zziplib/zziplib-src/docs/make-doc.py.me	2018-08-14 10:34:45.827143276 +0100
fcfc58
+++ texlive-20180414/source/libs/zziplib/zziplib-src/docs/make-doc.py	2018-08-14 10:35:09.287578374 +0100
fcfc58
@@ -951,7 +951,7 @@ def docbook_refpages_perheader(page_list
fcfc58
             header[file].copyright = page.copyright
fcfc58
         if not header[file].authors and page.authors:
fcfc58
             header[file].authors = page.authors
fcfc58
-        if not header[file].authors and page.authors_list:
fcfc58
+        if not header[file].authors_list and page.authors_list:
fcfc58
             header[file].authors_list = page.authors_list
fcfc58
         if not header[file].description:
fcfc58
             found = m(commands.getoutput("cat "+o.package+".spec"),
fcfc58
diff -up texlive-20180414/source/texk/dvipdfm-x/cid.c.me texlive-20180414/source/texk/dvipdfm-x/cid.c
fcfc58
--- texlive-20180414/source/texk/dvipdfm-x/cid.c.me	2018-08-14 14:23:43.959754741 +0100
fcfc58
+++ texlive-20180414/source/texk/dvipdfm-x/cid.c	2018-09-24 10:52:23.863792313 +0100
fcfc58
@@ -636,6 +636,7 @@ CIDFont_cache_find (const char *map_name
fcfc58
                            CIDFONT_FLAG_TYPE1C)              < 0 &&
fcfc58
         CIDFont_base_open (font, map_name, cmap_csi, opt)    < 0) {
fcfc58
       CIDFont_release(font);
fcfc58
+      RELEASE(font);
fcfc58
       release_opt(opt);
fcfc58
       return -1;
fcfc58
     } else {
fcfc58
diff -up texlive-20180414/source/texk/dvipdfm-x/dvi.c.me texlive-20180414/source/texk/dvipdfm-x/dvi.c
fcfc58
--- texlive-20180414/source/texk/dvipdfm-x/dvi.c.me	2018-08-14 14:31:53.138750339 +0100
fcfc58
+++ texlive-20180414/source/texk/dvipdfm-x/dvi.c	2018-08-14 14:41:37.729500250 +0100
fcfc58
@@ -1001,8 +1001,11 @@ dvi_locate_native_font (const char *file
fcfc58
     char     *enc_vec[256];
fcfc58
 
fcfc58
     fp = DPXFOPEN(filename, DPX_RES_TYPE_T1FONT);
fcfc58
-    if (!fp)
fcfc58
+    if (!fp) {
fcfc58
+      if (path)
fcfc58
+	free(path);
fcfc58
       return -1;
fcfc58
+    }
fcfc58
 
fcfc58
     if (!is_pfb(fp))
fcfc58
       ERROR("Failed to read Type 1 font \"%s\".", filename);
fcfc58
diff -up texlive-20180414/source/texk/dvipdfm-x/fontmap.c.me texlive-20180414/source/texk/dvipdfm-x/fontmap.c
fcfc58
--- texlive-20180414/source/texk/dvipdfm-x/fontmap.c.me	2018-09-24 12:45:22.068268381 +0100
fcfc58
+++ texlive-20180414/source/texk/dvipdfm-x/fontmap.c	2018-09-24 12:45:13.508111517 +0100
fcfc58
@@ -849,8 +849,8 @@ pdf_insert_fontmap_record (const char *k
fcfc58
     subfont_ids = sfd_get_subfont_ids(sfd_name, &n);
fcfc58
     if (!subfont_ids) {
fcfc58
       RELEASE(fnt_name);
fcfc58
-      RELEASE(sfd_name);
fcfc58
       WARN("Could not open SFD file: %s", sfd_name);
fcfc58
+      RELEASE(sfd_name);
fcfc58
       return NULL;
fcfc58
     }
fcfc58
     if (verbose > 3)
fcfc58
diff -up texlive-20180414/source/texk/dvipdfm-x/otl_conf.c.me texlive-20180414/source/texk/dvipdfm-x/otl_conf.c
fcfc58
--- texlive-20180414/source/texk/dvipdfm-x/otl_conf.c.me	2018-09-24 12:55:36.589529234 +0100
fcfc58
+++ texlive-20180414/source/texk/dvipdfm-x/otl_conf.c	2018-09-24 12:55:27.339359728 +0100
fcfc58
@@ -83,6 +83,7 @@ parse_uc_coverage (pdf_obj *gclass, cons
fcfc58
 	  pdf_add_array(coverage,
fcfc58
 			pdf_link_obj(pdf_get_array(cvalues, i)));
fcfc58
 	}
fcfc58
+	RELEASE(glyphclass);
fcfc58
       }
fcfc58
       break;
fcfc58
     default:
fcfc58
diff -up texlive-20180414/source/texk/dvipdfm-x/otl_opt.c.me texlive-20180414/source/texk/dvipdfm-x/otl_opt.c
fcfc58
--- texlive-20180414/source/texk/dvipdfm-x/otl_opt.c.me	2018-09-24 13:00:10.034538046 +0100
fcfc58
+++ texlive-20180414/source/texk/dvipdfm-x/otl_opt.c	2018-09-24 13:13:31.949224947 +0100
fcfc58
@@ -134,6 +134,7 @@ parse_expr (const char **pp, const char
fcfc58
         expr = parse_expr(pp, endptr);
fcfc58
         if (!expr) {
fcfc58
             WARN("Syntax error: %s\n", *pp);
fcfc58
+            bt_release_tree(root);
fcfc58
             return NULL;
fcfc58
         }
fcfc58
         if (**pp != ')') {
fcfc58
diff -up texlive-20180414/source/texk/dvipdfm-x/pdfdoc.c.me texlive-20180414/source/texk/dvipdfm-x/pdfdoc.c
fcfc58
--- texlive-20180414/source/texk/dvipdfm-x/pdfdoc.c.me	2018-09-24 13:04:07.928895033 +0100
fcfc58
+++ texlive-20180414/source/texk/dvipdfm-x/pdfdoc.c	2018-09-24 13:04:39.329470128 +0100
fcfc58
@@ -825,7 +825,7 @@ pdf_doc_close_page_tree (pdf_doc *p)
fcfc58
     pdf_page  *page;
fcfc58
 
fcfc58
     page = doc_get_page_entry(p, page_no);
fcfc58
-    if (page->page_obj) {
fcfc58
+    if (page->page_ref) {
fcfc58
       WARN("Nonexistent page #%ld refered.", page_no);
fcfc58
       pdf_release_obj(page->page_ref);
fcfc58
       page->page_ref = NULL;
fcfc58
diff -up texlive-20180414/source/texk/dvipdfm-x/pdfencrypt.c.me texlive-20180414/source/texk/dvipdfm-x/pdfencrypt.c
fcfc58
--- texlive-20180414/source/texk/dvipdfm-x/pdfencrypt.c.me	2018-09-24 13:05:05.679952732 +0100
fcfc58
+++ texlive-20180414/source/texk/dvipdfm-x/pdfencrypt.c	2018-09-24 13:10:25.655813021 +0100
fcfc58
@@ -616,7 +616,7 @@ pdf_enc_set_passwd (unsigned int bits, u
fcfc58
   }
fcfc58
   if (uplain) {
fcfc58
     if (preproc_password(uplain, upasswd, p->V) < 0)
fcfc58
-      WARN("Invalid UTF-8 string for passowrd.");
fcfc58
+      WARN("Invalid UTF-8 string for password.");
fcfc58
   } else {
fcfc58
     while (1) {
fcfc58
       strncpy(input, getpass("User password: "), MAX_PWD_LEN);
fcfc58
diff -up texlive-20180414/source/texk/dvipdfm-x/pdfobj.c.me texlive-20180414/source/texk/dvipdfm-x/pdfobj.c
fcfc58
--- texlive-20180414/source/texk/dvipdfm-x/pdfobj.c.me	2018-09-24 13:12:23.727975488 +0100
fcfc58
+++ texlive-20180414/source/texk/dvipdfm-x/pdfobj.c	2018-09-24 13:12:43.988346552 +0100
fcfc58
@@ -1862,8 +1862,9 @@ apply_filter_TIFF2_1_2_4 (unsigned char
fcfc58
         }
fcfc58
       }
fcfc58
     }
fcfc58
-    if (outbits > 0)
fcfc58
+    if (outbits > 0) {
fcfc58
       raster[k] = (outbuf << (8 - outbits)); k++;
fcfc58
+    }
fcfc58
   }
fcfc58
   RELEASE(prev);
fcfc58
 }
fcfc58
diff -up texlive-20180414/source/texk/dvipdfm-x/pkfont.c.me texlive-20180414/source/texk/dvipdfm-x/pkfont.c
fcfc58
--- texlive-20180414/source/texk/dvipdfm-x/pkfont.c.me	2018-09-24 13:14:24.490187294 +0100
fcfc58
+++ texlive-20180414/source/texk/dvipdfm-x/pkfont.c	2018-09-24 13:17:33.873656807 +0100
fcfc58
@@ -329,6 +329,7 @@ pk_decode_bitmap (pdf_obj *stream, uint3
fcfc58
     }
fcfc58
   }
fcfc58
 
fcfc58
+  free(rowptr);
fcfc58
   return  0;
fcfc58
 }
fcfc58
 
fcfc58
diff -up texlive-20180414/source/texk/dvipdfm-x/spc_dvips.c.me texlive-20180414/source/texk/dvipdfm-x/spc_dvips.c
fcfc58
--- texlive-20180414/source/texk/dvipdfm-x/spc_dvips.c.me	2018-09-24 13:20:43.777135845 +0100
fcfc58
+++ texlive-20180414/source/texk/dvipdfm-x/spc_dvips.c	2018-09-24 13:45:28.104313939 +0100
fcfc58
@@ -402,6 +402,7 @@ spc_handler_ps_tricks_bput (struct spc_e
fcfc58
       temporary_defs = dpx_create_temp_file();
fcfc58
     if (!temporary_defs) {
fcfc58
       WARN("Failed to create temporary input file for PSTricks image conversion.");
fcfc58
+      free(formula);
fcfc58
       return  -1;
fcfc58
     }
fcfc58
 
fcfc58
@@ -455,7 +456,7 @@ spc_handler_ps_tricks_brotate (struct sp
fcfc58
   if (calculate_PS(cmd, strlen(cmd), &value, 0, 0, 0, 0, 0) != 0)
fcfc58
     return -1;
fcfc58
   RAngles[RAngleCount] = value;
fcfc58
-
fcfc58
+  free(cmd);
fcfc58
   return  spc_handler_xtx_do_transform (spe->x_user, spe->y_user,
fcfc58
       cos(value * M_PI / 180), sin(value * M_PI / 180),
fcfc58
       -sin(value * M_PI / 180), cos(value * M_PI / 180),
fcfc58
@@ -491,12 +492,17 @@ spc_handler_ps_tricks_transform (struct
fcfc58
     concat[strlen(post)] = 0;
fcfc58
     concat = strstr(cmd, "{");
fcfc58
     *concat = ' ';
fcfc58
-    if (calculate_PS(cmd, strlen(cmd), &d1, &d2, &d3, &d4, &d5, &d6) != 0)
fcfc58
+    if (calculate_PS(cmd, strlen(cmd), &d1, &d2, &d3, &d4, &d5, &d6) != 0) {
fcfc58
+      free(cmd);
fcfc58
       return -1;
fcfc58
-    if (spc_handler_xtx_gsave (0, 0) != 0)
fcfc58
+    }
fcfc58
+    if (spc_handler_xtx_gsave (0, 0) != 0) {
fcfc58
+      free(cmd);
fcfc58
       return -1;
fcfc58
+    }
fcfc58
     return spc_handler_xtx_do_transform (spe->x_user, spe->y_user, d1, d2, d3, d4, d5, d6);
fcfc58
   }
fcfc58
+  free(cmd);
fcfc58
   return  spc_handler_xtx_grestore (0, 0);
fcfc58
 }
fcfc58
 
fcfc58
@@ -570,7 +576,8 @@ spc_handler_ps_tricks_parse_path (struct
fcfc58
       fwrite(args->curptr, 1, clip - args->curptr, fp);
fcfc58
       fprintf(fp, " stroke ");
fcfc58
       skip_white(&clip, args->endptr);
fcfc58
-      parse_ident(&clip, args->endptr);
fcfc58
+      char *token = parse_ident(&clip, args->endptr);
fcfc58
+      free(token);
fcfc58
       fwrite(clip, 1, args->endptr - clip, fp);
fcfc58
     }
fcfc58
 #endif
fcfc58
@@ -610,7 +617,9 @@ spc_handler_ps_tricks_parse_path (struct
fcfc58
   if (error) {
fcfc58
     WARN("Image format conversion for PSTricks failed.");
fcfc58
     RELEASE(gs_in);
fcfc58
+    RELEASE(gs_out);
fcfc58
     gs_in = 0;
fcfc58
+    gs_out = 0;
fcfc58
     return error;
fcfc58
   }
fcfc58
 
fcfc58
@@ -706,6 +715,7 @@ spc_handler_ps_tricks_render (struct spc
fcfc58
       WARN("Image format conversion for PSTricks failed.");
fcfc58
       RELEASE(gs_in);
fcfc58
       gs_in = 0;
fcfc58
+      RELEASE(gs_out);
fcfc58
       return error;
fcfc58
     }
fcfc58
 
fcfc58
@@ -1074,9 +1084,10 @@ int calculate_PS (char *string, int leng
fcfc58
       fscanf(coord, " %lf %lf ", res1, res2);
fcfc58
     else
fcfc58
       fscanf(coord, " [%lf %lf %lf %lf %lf %lf] ", res1, res2, res3, res4, res5, res6);
fcfc58
-  } else
fcfc58
+  } else {
fcfc58
+    RELEASE(cmd);
fcfc58
     return -1;
fcfc58
-
fcfc58
+  }
fcfc58
   pclose(coord);
fcfc58
   RELEASE(cmd);
fcfc58
   dpx_delete_temp_file(formula, true);
fcfc58
diff -up texlive-20180414/source/texk/dvipdfm-x/spc_util.c.me texlive-20180414/source/texk/dvipdfm-x/spc_util.c
fcfc58
--- texlive-20180414/source/texk/dvipdfm-x/spc_util.c.me	2018-09-24 13:50:50.730216569 +0100
fcfc58
+++ texlive-20180414/source/texk/dvipdfm-x/spc_util.c	2018-09-24 13:54:23.844113385 +0100
fcfc58
@@ -149,6 +149,7 @@ spc_read_color_color (struct spc_env *sp
fcfc58
     char *color_name = parse_c_ident(&ap->curptr, ap->endptr);
fcfc58
     if (!color_name) {
fcfc58
       spc_warn(spe, "No valid spot color name specified?");
fcfc58
+      RELEASE(q);
fcfc58
       return  -1;
fcfc58
     }
fcfc58
     skip_blank(&ap->curptr, ap->endptr);
fcfc58
diff -up texlive-20180414/source/texk/dvipdfm-x/t1_load.c.me texlive-20180414/source/texk/dvipdfm-x/t1_load.c
fcfc58
--- texlive-20180414/source/texk/dvipdfm-x/t1_load.c.me	2018-09-24 13:55:59.085854887 +0100
fcfc58
+++ texlive-20180414/source/texk/dvipdfm-x/t1_load.c	2018-09-24 13:58:52.979034543 +0100
fcfc58
@@ -632,6 +632,9 @@ parse_subrs (cff_font *font,
fcfc58
     if (!PST_INTEGERTYPE(tok) || pst_getIV(tok) < 0 ||
fcfc58
         pst_getIV(tok) > CS_STR_LEN_MAX) {
fcfc58
       RELEASE_TOK(tok);
fcfc58
+      if (offsets) RELEASE(offsets);
fcfc58
+      if (data)    RELEASE(data);
fcfc58
+      if (lengths) RELEASE(lengths);
fcfc58
       return -1;
fcfc58
     }
fcfc58
     len = pst_getIV(tok);
fcfc58
diff -up texlive-20180414/source/texk/dvipdfm-x/tt_cmap.c.me texlive-20180414/source/texk/dvipdfm-x/tt_cmap.c
fcfc58
--- texlive-20180414/source/texk/dvipdfm-x/tt_cmap.c.me	2018-09-24 14:03:33.954172208 +0100
fcfc58
+++ texlive-20180414/source/texk/dvipdfm-x/tt_cmap.c	2018-09-24 14:07:07.738081269 +0100
fcfc58
@@ -1237,6 +1237,7 @@ otf_create_ToUnicode_stream (const char
fcfc58
   res_id = pdf_findresource("CMap", cmap_name);
fcfc58
   if (res_id >= 0) {
fcfc58
     RELEASE(cmap_name);
fcfc58
+    RELEASE(normalized_font_name);
fcfc58
     cmap_ref = pdf_get_resource_reference(res_id);
fcfc58
     return cmap_ref;
fcfc58
   }
fcfc58
@@ -1254,6 +1255,7 @@ otf_create_ToUnicode_stream (const char
fcfc58
     sfont = dfont_open(fp, ttc_index);
fcfc58
   } else  {
fcfc58
     RELEASE(cmap_name);
fcfc58
+    RELEASE(normalized_font_name);
fcfc58
     return NULL;
fcfc58
   }
fcfc58
 
fcfc58
diff -up texlive-20180414/source/texk/dvipng/dvipng-src/font.c.me texlive-20180414/source/texk/dvipng/dvipng-src/font.c
fcfc58
diff -up texlive-20180414/source/texk/dvipng/dvipng-src/misc.c.me texlive-20180414/source/texk/dvipng/dvipng-src/misc.c
fcfc58
diff -up texlive-20180414/source/texk/dvipng/dvipng-src/sfd.c.me texlive-20180414/source/texk/dvipng/dvipng-src/sfd.c
fcfc58
--- texlive-20180414/source/texk/dvipng/dvipng-src/sfd.c.me	2018-09-24 14:25:21.188076748 +0100
fcfc58
+++ texlive-20180414/source/texk/dvipng/dvipng-src/sfd.c	2018-09-24 14:28:14.741252282 +0100
fcfc58
@@ -139,8 +139,10 @@ struct psfontmap* FindSubFont(struct psf
fcfc58
   sfdname[postfix-sfdspec]='\0';
fcfc58
   /* Check postfix */
fcfc58
   postfix++;
fcfc58
-  if (strcmp(sfdwant+strlen(sfdwant)-strlen(postfix),postfix)!=0)
fcfc58
+  if (strcmp(sfdwant+strlen(sfdwant)-strlen(postfix),postfix)!=0) {
fcfc58
+    free(sfdname);
fcfc58
     return(NULL);
fcfc58
+  }
fcfc58
   /* Extract infix */
fcfc58
   if ((infix=malloc(strlen(sfdwant)-strlen(postfix)+1))==NULL)
fcfc58
     Fatal("cannot allocate memory for subfont infix");
fcfc58
diff -up texlive-20180414/source/texk/dvipos/dvipos.c.me texlive-20180414/source/texk/dvipos/dvipos.c
fcfc58
--- texlive-20180414/source/texk/dvipos/dvipos.c.me	2018-09-24 14:28:22.821400126 +0100
fcfc58
+++ texlive-20180414/source/texk/dvipos/dvipos.c	2018-09-24 14:33:37.367155421 +0100
fcfc58
@@ -246,7 +246,7 @@ int main (int argc, char *argv[])
fcfc58
 
fcfc58
   if (infname) free(infname);
fcfc58
   if (outfname) free(outfname);
fcfc58
-  if (bbxfname) free(frmfname);
fcfc58
+  if (bbxfname) free(bbxfname);
fcfc58
   if (frmfname) free(frmfname);
fcfc58
 
fcfc58
   if (outfp) fclose(outfp);
fcfc58
diff -up texlive-20180414/source/texk/dvipsk/dospecial.c.me texlive-20180414/source/texk/dvipsk/dospecial.c
fcfc58
diff -up texlive-20180414/source/texk/dvipsk/emspecial.c.me texlive-20180414/source/texk/dvipsk/emspecial.c
fcfc58
--- texlive-20180414/source/texk/dvipsk/emspecial.c.me	2018-09-24 15:01:40.267917277 +0100
fcfc58
+++ texlive-20180414/source/texk/dvipsk/emspecial.c	2018-09-24 15:20:25.108474385 +0100
fcfc58
@@ -811,8 +813,10 @@ MSP_2_ps(FILE *f, int wide, int high)
fcfc58
 	linelen = (halfword *) mymalloc((integer)sizeof(halfword) * high);
fcfc58
 	for (i = 0; i < high; i++) {
fcfc58
 		linelen[i] = readhalfword(f);
fcfc58
-		if (feof(f))
fcfc58
+		if (feof(f)) {
fcfc58
+			free(linelen);
fcfc58
 			return;
fcfc58
+		}
fcfc58
 	}
fcfc58
 
fcfc58
 	line = (char *) mymalloc((integer)tobyte(wide));
fcfc58
@@ -1308,6 +1312,8 @@ bmpgraph(FILE *f, char *filename, float
fcfc58
 		    default:
fcfc58
 			sprintf(errbuf,"em:graph: Unknown BMP compression\n");
fcfc58
 			specerror(errbuf);
fcfc58
+			if (line) free(line);
fcfc58
+			if (pshexa) free(pshexa);
fcfc58
 			return;
fcfc58
 		}
fcfc58
 
fcfc58
--- texlive-20180414/source/texk/dvipsk/t1part.c.me	2018-09-24 15:47:04.767750977 +0100
fcfc58
+++ texlive-20180414/source/texk/dvipsk/t1part.c	2018-09-24 16:02:33.294747092 +0100
fcfc58
@@ -2458,6 +2458,7 @@ Afm(void)
fcfc58
             }
fcfc58
         }
fcfc58
     }
fcfc58
+    fclose(fafm);
fcfc58
     return -2;
fcfc58
 }
fcfc58
 
fcfc58
@@ -2526,6 +2527,7 @@ FontPart(FILE *fout, unsigned char *font
fcfc58
                 NameOfProgram();
fcfc58
                 (void) fprintf(stderr,
fcfc58
                 "Error: %s is not a valid PFA file\n", fontfile);
fcfc58
+		fclose(fin);
fcfc58
                 return -1;
fcfc58
             }
fcfc58
 
fcfc58
@@ -2543,6 +2545,7 @@ FontPart(FILE *fout, unsigned char *font
fcfc58
                 NameOfProgram();
fcfc58
                 (void) fprintf(stderr,
fcfc58
                 "Error: %s is not a valid PFB file\n", fontfile);
fcfc58
+		fclose(fin);
fcfc58
                 return -1;
fcfc58
             }
fcfc58
             break;
fcfc58
@@ -2677,6 +2680,7 @@ LoadVector(int num, CHAR *TmpChar)
fcfc58
     }
fcfc58
     else
fcfc58
     {
fcfc58
+        fclose(fvect);
fcfc58
         fprintf(stderr,"\n Error: ending token 'def' not found in <%s> \n",
fcfc58
         psvectfile);
fcfc58
         return -2;
fcfc58
diff -up texlive-20180414/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/splineorder2.c.me texlive-20180414/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/splineorder2.c
fcfc58
--- texlive-20180414/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/splineorder2.c.me	2018-09-25 08:19:26.742304540 +0100
fcfc58
+++ texlive-20180414/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/splineorder2.c	2018-09-25 08:20:04.753003584 +0100
fcfc58
@@ -1289,9 +1289,9 @@ return;
fcfc58
     unit.x = from->nextcp.x-from->me.x;
fcfc58
     unit.y = from->nextcp.y-from->me.y;
fcfc58
     len = sqrt(unit.x*unit.x + unit.y*unit.y);
fcfc58
-    if ( len!=0 )
fcfc58
+    if ( len!=0 ) {
fcfc58
 	unit.x /= len; unit.y /= len;
fcfc58
-
fcfc58
+    }
fcfc58
     if ( (fpt = from->pointtype)==pt_hvcurve ) fpt = pt_curve;
fcfc58
     if ( (tpt =   to->pointtype)==pt_hvcurve ) tpt = pt_curve;
fcfc58
     if ( from->nextcpdef && to->prevcpdef ) switch ( fpt*3+tpt ) {
fcfc58
diff -up texlive-20180414/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/tottf.c.me texlive-20180414/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/tottf.c
fcfc58
--- texlive-20180414/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/tottf.c.me	2018-09-25 09:12:58.071419844 +0100
fcfc58
+++ texlive-20180414/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/tottf.c	2018-09-25 09:12:50.021271829 +0100
fcfc58
@@ -4273,9 +4273,10 @@ return( NULL );
fcfc58
 		(subheadcnt-i)*sizeof(struct subhead) + sizeof(uint16);
fcfc58
 
fcfc58
     sub = tmpfile2();
fcfc58
-    if ( sub==NULL )
fcfc58
-return( NULL );
fcfc58
-
fcfc58
+    if ( sub==NULL ) {
fcfc58
+	free(glyphs);
fcfc58
+	return( NULL );
fcfc58
+    }
fcfc58
     putshort(sub,2);		/* 8/16 format */
fcfc58
     putshort(sub,0);		/* Subtable length, we'll come back and fix this */
fcfc58
     putshort(sub,0);		/* version/language, not meaningful in ms systems */
fcfc58
diff -up texlive-20180414/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/ttfspecial.c.me texlive-20180414/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/ttfspecial.c
fcfc58
--- texlive-20180414/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/ttfspecial.c.me	2018-09-25 09:50:27.032676224 +0100
fcfc58
+++ texlive-20180414/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/fontforge/ttfspecial.c	2018-09-25 09:47:22.249288133 +0100
fcfc58
@@ -1343,6 +1343,8 @@ static void pfed_read_glyph_layer(FILE *
fcfc58
 		LogError(_("Whoops, Ran out of spiros\n"));
fcfc58
 	}
fcfc58
     }
fcfc58
+    free(cur->layers);
fcfc58
+    free(cur);
fcfc58
     free(contours);
fcfc58
 }
fcfc58
 
fcfc58
diff -up texlive-20180414/source/texk/kpathsea/cnf.c.me texlive-20180414/source/texk/kpathsea/cnf.c
fcfc58
--- texlive-20180414/source/texk/kpathsea/cnf.c.me	2018-09-25 10:02:44.406129099 +0100
fcfc58
+++ texlive-20180414/source/texk/kpathsea/cnf.c	2018-09-25 10:50:20.648575054 +0100
fcfc58
@@ -132,6 +132,8 @@ do_line (kpathsea kpse, string line)
fcfc58
   while (len > 0 && ISSPACE (start[len - 1]))
fcfc58
     len--;
fcfc58
   if (len == 0) {
fcfc58
+    if (prog) free (prog);
fcfc58
+    if (var) free (var);
fcfc58
     return ("No cnf value");
fcfc58
   }
fcfc58
   
fcfc58
@@ -234,7 +236,6 @@ read_all_cnf (kpathsea kpse)
fcfc58
       xfclose (cnf_file, *cnf);
fcfc58
       free (*cnf);
fcfc58
     }
fcfc58
-    free (cnf_files);
fcfc58
   } else {
fcfc58
     string warn = getenv ("KPATHSEA_WARNING");
fcfc58
     if (!(warn && STREQ (warn, "0"))) {
fcfc58
@@ -243,6 +244,7 @@ read_all_cnf (kpathsea kpse)
fcfc58
         cnf_path);
fcfc58
     }
fcfc58
   }
fcfc58
+  free (cnf_files);
fcfc58
 }
fcfc58
 
fcfc58
 /* Read the cnf files on the first call.  Return the first value in the
fcfc58
diff -up texlive-20180414/source/texk/kpathsea/fontmap.c.me texlive-20180414/source/texk/kpathsea/fontmap.c
fcfc58
--- texlive-20180414/source/texk/kpathsea/fontmap.c.me	2018-09-25 10:24:28.990061334 +0100
fcfc58
+++ texlive-20180414/source/texk/kpathsea/fontmap.c	2018-09-25 10:25:08.310783006 +0100
fcfc58
@@ -162,6 +162,7 @@ read_all_maps (kpathsea kpse)
fcfc58
     map_file_parse (kpse, *filenames);
fcfc58
     filenames++;
fcfc58
   }
fcfc58
+  free(filenames);
fcfc58
 }
fcfc58
 
fcfc58
 /* Look up KEY in texfonts.map's; if it's not found, remove any suffix
fcfc58
diff -up texlive-20180414/source/texk/kpathsea/kpsewhich.c.me texlive-20180414/source/texk/kpathsea/kpsewhich.c
fcfc58
--- texlive-20180414/source/texk/kpathsea/kpsewhich.c.me	2018-09-25 10:29:35.985696560 +0100
fcfc58
+++ texlive-20180414/source/texk/kpathsea/kpsewhich.c	2018-09-25 10:50:53.349178562 +0100
fcfc58
@@ -742,7 +742,8 @@ kpathsea_set_program_enabled (kpse, fmt,
fcfc58
   DISABLE_MKTEX (kpse_ocp_format);
fcfc58
 
fcfc58
   /* NULL for no fallback font.  */
fcfc58
-  kpathsea_init_prog (kpse, uppercasify (kpse->program_name), dpi, mode, NULL);
fcfc58
+  string PROG = uppercasify (kpse->program_name);
fcfc58
+  kpathsea_init_prog (kpse, PROG, dpi, mode, NULL);
fcfc58
 
fcfc58
   /* Have to do this after setting the program name.  */
fcfc58
   if (user_format_string) {
fcfc58
@@ -752,6 +753,7 @@ kpathsea_set_program_enabled (kpse, fmt,
fcfc58
                 user_format_string);
fcfc58
     }
fcfc58
   }
fcfc58
+  free(PROG);
fcfc58
 }
fcfc58
 
fcfc58
 
fcfc58
diff -up texlive-20180414/source/texk/kpathsea/mktexlsr.me texlive-20180414/source/texk/kpathsea/mktexlsr
fcfc58
--- texlive-20180414/source/texk/kpathsea/mktexlsr.me	2018-08-14 09:49:37.815932357 +0100
fcfc58
+++ texlive-20180414/source/texk/kpathsea/mktexlsr	2018-08-14 09:51:12.685644501 +0100
fcfc58
@@ -71,18 +71,18 @@ esac
fcfc58
 
fcfc58
 if tty -s; then verbose=true; else verbose=false; fi
fcfc58
 dry_run=false
fcfc58
-trees=
fcfc58
+trees=mktexlsrtrees
fcfc58
 
fcfc58
 # initialize treefile by either mktemp or some random name
fcfc58
 # code taken from pdfjam and adjusted
fcfc58
 {
fcfc58
   treefile=`
fcfc58
-    (umask 077 && mktemp "${TMPDIR-/tmp}/mktexlsrtrees.XXXXXXXXXX") 2>/dev/null
fcfc58
+    (umask 077 && mktemp "${TMPDIR-/tmp}/$trees.XXXXXXXXXX") 2>/dev/null
fcfc58
   ` && test -n "$treefile" && test -f "$treefile"
fcfc58
 } || {
fcfc58
   ##  We'll use awk to make random number, for portability
fcfc58
   random=`awk 'END { srand(); printf ("%d\n", rand()*1000000); }' /dev/null`
fcfc58
-  treefile="${TMPDIR-/tmp}/mktexlsrtrees$$.$random"
fcfc58
+  treefile="${TMPDIR-/tmp}/$trees$$.$random"
fcfc58
 } || exit $?
fcfc58
 
fcfc58
 trap 'cd /; rm -f $treefile; test -z "$db_dir_tmp" || rm -rf "$db_dir_tmp"; 
fcfc58
diff -up texlive-20180414/source/texk/kpathsea/tex-file.c.me texlive-20180414/source/texk/kpathsea/tex-file.c
fcfc58
--- texlive-20180414/source/texk/kpathsea/tex-file.c.me	2018-09-25 10:47:56.305911131 +0100
fcfc58
+++ texlive-20180414/source/texk/kpathsea/tex-file.c	2018-09-25 13:11:34.995055022 +0100
fcfc58
@@ -434,6 +434,7 @@ init_maketex (kpathsea kpse, kpse_file_f
fcfc58
                                   kpse_src_client_cnf);
fcfc58
   }
fcfc58
 
fcfc58
+  if (progval) free (progval);
fcfc58
   free (PROG);
fcfc58
 }
fcfc58
 
fcfc58
diff -up texlive-20180414/source/texk/kpathsea/tex-glyph.c.me texlive-20180414/source/texk/kpathsea/tex-glyph.c
fcfc58
--- texlive-20180414/source/texk/kpathsea/tex-glyph.c.me	2018-09-25 14:58:28.564047833 +0100
fcfc58
+++ texlive-20180414/source/texk/kpathsea/tex-glyph.c	2018-09-25 14:59:16.634928903 +0100
fcfc58
@@ -177,7 +177,7 @@ try_fontmap (kpathsea kpse, const_string
fcfc58
       *fontname_ptr = xstrdup (first_name);
fcfc58
     }
fcfc58
   }
fcfc58
-
fcfc58
+  free (mapped_names);
fcfc58
   return ret;
fcfc58
 }
fcfc58
 
fcfc58
diff -up texlive-20180414/source/texk/kpathsea/tex-make.c.me texlive-20180414/source/texk/kpathsea/tex-make.c
fcfc58
--- texlive-20180414/source/texk/kpathsea/tex-make.c.me	2018-10-01 12:28:44.510074773 +0100
fcfc58
+++ texlive-20180414/source/texk/kpathsea/tex-make.c	2018-10-01 13:24:01.201630392 +0100
fcfc58
@@ -116,8 +116,9 @@ misstex (kpathsea kpse, kpse_file_format
fcfc58
 
fcfc58
     kpse->missfont
fcfc58
       = missfont_name ? fopen (missfont_name, FOPEN_A_MODE) : NULL;
fcfc58
-    if (!kpse->missfont && kpathsea_var_value (kpse, "TEXMFOUTPUT")) {
fcfc58
-      missfont_name = concat3 (kpathsea_var_value (kpse, "TEXMFOUTPUT"),
fcfc58
+    char *texmfoutput = kpathsea_var_value (kpse, "TEXMFOUTPUT");
fcfc58
+    if (!kpse->missfont && texmfoutput) {
fcfc58
+      missfont_name = concat3 (texmfoutput,
fcfc58
                                DIR_SEP_STRING, missfont_name);
fcfc58
       kpse->missfont = fopen (missfont_name, FOPEN_A_MODE);
fcfc58
     }
fcfc58
@@ -125,6 +126,7 @@ misstex (kpathsea kpse, kpse_file_format
fcfc58
     if (kpse->missfont)
fcfc58
       fprintf (stderr, "kpathsea: Appending font creation commands to %s.\n",
fcfc58
                missfont_name);
fcfc58
+    free (texmfoutput);
fcfc58
   }
fcfc58
 
fcfc58
   /* Write the command if we have a log file.  */
fcfc58
@@ -439,6 +441,7 @@ kpathsea_make_tex (kpathsea kpse, kpse_f
fcfc58
     if (base[0] == '-' /* || IS_DIR_SEP(base[0])  */) {
fcfc58
       fprintf(stderr, "kpathsea:make_tex: Invalid filename `%s', starts with '%c'\n",
fcfc58
               base, base[0]);
fcfc58
+      free (args);
fcfc58
       return NULL;
fcfc58
     }
fcfc58
     for (i = 0; base[i]; i++) {
fcfc58
@@ -451,6 +454,7 @@ kpathsea_make_tex (kpathsea kpse, kpse_f
fcfc58
       {
fcfc58
         fprintf(stderr, "kpathsea:make_tex: Invalid filename `%s', contains '%c'\n",
fcfc58
                 base, base[i]);
fcfc58
+	free (args);
fcfc58
         return NULL;
fcfc58
       }
fcfc58
     }
fcfc58
diff -up texlive-20180414/source/texk/makeindexk/mkindex.me texlive-20180414/source/texk/makeindexk/mkindex
fcfc58
--- texlive-20180414/source/texk/makeindexk/mkindex.me	2018-08-14 09:48:13.864392161 +0100
fcfc58
+++ texlive-20180414/source/texk/makeindexk/mkindex	2018-08-14 09:48:34.564771939 +0100
fcfc58
@@ -13,7 +13,7 @@ unset RUNNING_BSH
fcfc58
 progname=`basename $0`
fcfc58
 case $# in
fcfc58
   0) 
fcfc58
-    echo "usage: `basename $0` file[.idx] ..." 1>&2
fcfc58
+    echo "usage: $progname file[.idx] ..." 1>&2
fcfc58
     exit 1
fcfc58
     ;;
fcfc58
 esac
fcfc58
diff -up texlive-20180414/source/texk/web2c/lib/openclose.c.me texlive-20180414/source/texk/web2c/lib/openclose.c
fcfc58
--- texlive-20180414/source/texk/web2c/lib/openclose.c.me	2018-10-02 15:06:29.670502929 +0100
fcfc58
+++ texlive-20180414/source/texk/web2c/lib/openclose.c	2018-10-02 15:09:52.234270066 +0100
fcfc58
@@ -303,6 +303,7 @@ open_output (FILE **f_ptr, const_string
fcfc58
             fname = concat3(texmfoutput, DIR_SEP_STRING, nameoffile+1);
fcfc58
             *f_ptr = fopen(fname, fopen_mode);
fcfc58
         }
fcfc58
+	free (texmfoutput);
fcfc58
     }
fcfc58
     /* If this succeeded, change nameoffile accordingly.  */
fcfc58
     if (*f_ptr) {
fcfc58
diff -up texlive-20180414/source/texk/web2c/lib/texmfmp.c.me texlive-20180414/source/texk/web2c/lib/texmfmp.c
fcfc58
--- texlive-20180414/source/texk/web2c/lib/texmfmp.c.me	2018-10-04 09:45:15.432099911 +0100
fcfc58
+++ texlive-20180414/source/texk/web2c/lib/texmfmp.c	2018-10-04 10:22:47.004046653 +0100
fcfc58
@@ -654,7 +654,9 @@ static boolean
fcfc58
 texmf_yesno(const_string var)
fcfc58
 {
fcfc58
   string value = kpse_var_value (var);
fcfc58
-  return value && (*value == 't' || *value == 'y' || *value == '1');
fcfc58
+  boolean temp_value = (value && (*value == 't' || *value == 'y' || *value == '1'));
fcfc58
+  free (value);
fcfc58
+  return temp_value;
fcfc58
 }
fcfc58
 
fcfc58
 #ifdef pdfTeX
fcfc58
@@ -899,6 +901,7 @@ maininit (int ac, string *av)
fcfc58
     }
fcfc58
     DUMP_VAR = concat (" ", with_ext); /* adjust array for Pascal */
fcfc58
     DUMP_LENGTH_VAR = strlen (DUMP_VAR + 1);
fcfc58
+    free (with_ext);
fcfc58
   } else {
fcfc58
     /* For dump_name to be NULL is a bug.  */
fcfc58
     abort();
fcfc58
@@ -1379,11 +1382,9 @@ tcx_get_num (int upb,
fcfc58
 void
fcfc58
 readtcxfile (void)
fcfc58
 {
fcfc58
-  string orig_filename;
fcfc58
   if (!find_suffix (translate_filename)) {
fcfc58
     translate_filename = concat (translate_filename, ".tcx");
fcfc58
   }
fcfc58
-  orig_filename = translate_filename;
fcfc58
   translate_filename
fcfc58
     = kpse_find_file (translate_filename, kpse_web2c_format, true);
fcfc58
   if (translate_filename) {
fcfc58
@@ -1434,7 +1435,7 @@ readtcxfile (void)
fcfc58
     }
fcfc58
     xfclose(translate_file, translate_filename);
fcfc58
   } else {
fcfc58
-    WARNING1 ("Could not open char translation file `%s'", orig_filename);
fcfc58
+    WARNING1 ("Could not open char translation file `%s'", translate_filename);
fcfc58
   }
fcfc58
 }
fcfc58
 #endif /* !Aleph && !XeTeX */
fcfc58
@@ -2888,7 +2889,9 @@ boolean
fcfc58
 isnewsource (strnumber srcfilename, int lineno)
fcfc58
 {
fcfc58
   char *name = gettexstring(srcfilename);
fcfc58
-  return (compare_paths(name, last_source_name) != 0 || lineno != last_lineno);
fcfc58
+  boolean tmp_name = (compare_paths(name, last_source_name) != 0 || lineno != last_lineno);
fcfc58
+  free (name);
fcfc58
+  return tmp_name;
fcfc58
 }
fcfc58
 
fcfc58
 void
fcfc58
@@ -2926,6 +2929,7 @@ makesrcspecial (strnumber srcfilename, i
fcfc58
   while (*s)
fcfc58
     strpool[poolptr++] = *s++;
fcfc58
 
fcfc58
+  free (filename);
fcfc58
   return (oldpoolptr);
fcfc58
 }
fcfc58
 
fcfc58
@@ -3223,6 +3227,7 @@ void getfiledump(integer s, int offset,
fcfc58
     recorder_record_input(file_name);
fcfc58
     if (fseek(f, offset, SEEK_SET) != 0) {
fcfc58
         xfree(file_name);
fcfc58
+        fclose(f);
fcfc58
         return;
fcfc58
     }
fcfc58
     /* there is enough space in the string pool, the read
fcfc58
diff -up texlive-20180414/source/texk/web2c/luatexdir/font/luafont.w.me texlive-20180414/source/texk/web2c/luatexdir/font/luafont.w
fcfc58
--- texlive-20180414/source/texk/web2c/luatexdir/font/luafont.w.me	2018-10-04 10:46:48.310815583 +0100
fcfc58
+++ texlive-20180414/source/texk/web2c/luatexdir/font/luafont.w	2018-10-04 10:57:37.192864136 +0100
fcfc58
@@ -1102,8 +1102,8 @@ static void font_char_from_lua(lua_State
fcfc58
 {
fcfc58
     int k, r, t, lt, u, n;
fcfc58
     charinfo *co;
fcfc58
-    kerninfo *ckerns;
fcfc58
-    liginfo *cligs;
fcfc58
+    kerninfo *ckerns = NULL;
fcfc58
+    liginfo *cligs = NULL;
fcfc58
     scaled j;
fcfc58
     const char *s;
fcfc58
     int nl = 0;                 /* number of ligature table items */
fcfc58
@@ -1403,6 +1403,8 @@ static void font_char_from_lua(lua_State
fcfc58
             lua_pop(L, 1);      /* ligatures table */
fcfc58
         }
fcfc58
     }
fcfc58
+    if (ckerns) free (ckerns);
fcfc58
+    if (cligs) free (cligs);
fcfc58
 }
fcfc58
 
fcfc58
 @ The caller has to fix the state of the lua stack when there is an error!
fcfc58
diff -up texlive-20180414/source/texk/web2c/luatexdir/font/tfmofm.w.me texlive-20180414/source/texk/web2c/luatexdir/font/tfmofm.w
fcfc58
--- texlive-20180414/source/texk/web2c/luatexdir/font/tfmofm.w.me	2018-10-04 11:06:22.002603849 +0100
fcfc58
+++ texlive-20180414/source/texk/web2c/luatexdir/font/tfmofm.w	2018-10-04 11:06:46.713062328 +0100
fcfc58
@@ -1036,6 +1036,8 @@ int read_tfm_info(internal_font_number f
fcfc58
         }
fcfc58
     }
fcfc58
 
fcfc58
+    free (cligs);
fcfc58
+    free (ckerns);
fcfc58
     cligs = NULL;
fcfc58
     ckerns = NULL;
fcfc58
 
fcfc58
diff -up texlive-20180414/source/texk/web2c/luatexdir/font/vfovf.w.me texlive-20180414/source/texk/web2c/luatexdir/font/vfovf.w
fcfc58
--- texlive-20180414/source/texk/web2c/luatexdir/font/vfovf.w.me	2018-10-04 13:46:33.030731080 +0100
fcfc58
+++ texlive-20180414/source/texk/web2c/luatexdir/font/vfovf.w	2018-10-04 14:05:38.882001697 +0100
fcfc58
@@ -760,6 +760,8 @@ void do_vf(internal_font_number f)
fcfc58
             vf_read_u(4, utmp);
fcfc58
             cc = (int) utmp;
fcfc58
             if (!char_exists(f, cc)) {
fcfc58
+                if (vf_local_fnts) free (vf_local_fnts);
fcfc58
+                if (vf_real_fnts) free (vf_real_fnts);
fcfc58
                 bad_vf("invalid character code");
fcfc58
             }
fcfc58
             vf_read(4, k);
fcfc58
@@ -768,6 +770,8 @@ void do_vf(internal_font_number f)
fcfc58
             packet_length = cmd;
fcfc58
             vf_byte(cc);
fcfc58
             if (!char_exists(f, cc)) {
fcfc58
+                if (vf_local_fnts) free (vf_local_fnts);
fcfc58
+                if (vf_real_fnts) free (vf_real_fnts);
fcfc58
                 bad_vf("invalid character code");
fcfc58
             }
fcfc58
             vf_read_u(3, utmp);
fcfc58
@@ -820,9 +824,12 @@ void do_vf(internal_font_number f)
fcfc58
                 n = 0;
fcfc58
                 while ((n < vf_nf) && (vf_local_fnts[n] != (unsigned) k))
fcfc58
                     n++;
fcfc58
-                if (n == vf_nf)
fcfc58
+                if (n == vf_nf) {
fcfc58
+                    if (vpackets) free (vpackets);
fcfc58
+                    if (vf_local_fnts) free (vf_local_fnts);
fcfc58
+                    if (vf_real_fnts) free (vf_real_fnts);
fcfc58
                     bad_vf("undefined local font");
fcfc58
-
fcfc58
+                }
fcfc58
                 k = (int) vf_real_fnts[n];
fcfc58
                 append_fnt_set(k);
fcfc58
                 cmd_length = 0;
fcfc58
@@ -938,8 +945,12 @@ void do_vf(internal_font_number f)
fcfc58
                     vf_read_u((cmd - xxx1 + 1), utmp);
fcfc58
                     cmd_length = (int) utmp;
fcfc58
                     packet_length -= (cmd - xxx1 + 1);
fcfc58
-                    if (cmd_length <= 0)
fcfc58
+                    if (cmd_length <= 0) {
fcfc58
+                       if (vpackets) free (vpackets);
fcfc58
+                       if (vf_local_fnts) free (vf_local_fnts);
fcfc58
+                       if (vf_real_fnts) free (vf_real_fnts);
fcfc58
                         bad_vf("special of negative length");
fcfc58
+                    }
fcfc58
                     packet_length -= (unsigned) cmd_length;
fcfc58
 
fcfc58
                     append_packet(packet_special_code);
fcfc58
@@ -982,6 +993,9 @@ void do_vf(internal_font_number f)
fcfc58
                     break;
fcfc58
                 case pop:
fcfc58
                     if (stack_level == 0) {
fcfc58
+                       if (vpackets) free (vpackets);
fcfc58
+                       if (vf_local_fnts) free (vf_local_fnts);
fcfc58
+                       if (vf_real_fnts) free (vf_real_fnts);
fcfc58
                         bad_vf("more POPs than PUSHs in character");
fcfc58
                     } else {
fcfc58
                         decr(stack_level);
fcfc58
@@ -993,6 +1007,9 @@ void do_vf(internal_font_number f)
fcfc58
                     }
fcfc58
                     break;
fcfc58
                 default:
fcfc58
+                    if (vf_local_fnts) free (vf_local_fnts);
fcfc58
+                    if (vf_real_fnts) free (vf_real_fnts);
fcfc58
+                    if (vpackets) free (vpackets);
fcfc58
                     bad_vf("improver DVI command");
fcfc58
                 }
fcfc58
             }
fcfc58
@@ -1000,18 +1017,26 @@ void do_vf(internal_font_number f)
fcfc58
         /* signal end of packet */
fcfc58
         append_packet(packet_end_code);
fcfc58
 
fcfc58
-        if (stack_level != 0)
fcfc58
+        if (stack_level != 0) {
fcfc58
+            if (vf_local_fnts) free (vf_local_fnts);
fcfc58
+            if (vf_real_fnts) free (vf_real_fnts);
fcfc58
+            if (vpackets) free (vpackets);
fcfc58
             bad_vf("more PUSHs than POPs in character packet");
fcfc58
+        }
fcfc58
         if (packet_length != 0)
fcfc58
             bad_vf("invalid packet length or DVI command in packet");
fcfc58
         /* \.{Store the packet being built} */
fcfc58
         set_charinfo_packets(co, vpackets);
fcfc58
         vf_byte(cmd);
fcfc58
     }
fcfc58
-    if (cmd != post)
fcfc58
+    if (cmd != post) {
fcfc58
+        if (vf_local_fnts) free (vf_local_fnts);
fcfc58
+        if (vf_real_fnts) free (vf_real_fnts);
fcfc58
         bad_vf("POST command expected");
fcfc58
-
fcfc58
+    }
fcfc58
     xfree(vf_buffer);
fcfc58
+    if (vf_local_fnts) free (vf_local_fnts);
fcfc58
+    if (vf_real_fnts) free (vf_real_fnts);
fcfc58
 }
fcfc58
 
fcfc58
 @ @c
fcfc58
diff -up texlive-20180414/source/texk/web2c/luatexdir/font/writecff.w.me texlive-20180414/source/texk/web2c/luatexdir/font/writecff.w
fcfc58
--- texlive-20180414/source/texk/web2c/luatexdir/font/writecff.w.me	2018-10-04 14:46:50.747887890 +0100
fcfc58
+++ texlive-20180414/source/texk/web2c/luatexdir/font/writecff.w	2018-10-04 16:09:12.999654546 +0100
fcfc58
@@ -1105,6 +1105,7 @@ cff_font *read_cff(unsigned char *buf, l
fcfc58
         if (n > idx->count - 1) {
fcfc58
             normal_warning("cff","invalid fontset index number");
fcfc58
             cff_close(cff);
fcfc58
+            cff_release_index(idx);
fcfc58
             return NULL;
fcfc58
         }
fcfc58
         cff->name = idx;
fcfc58
@@ -1121,6 +1122,7 @@ cff_font *read_cff(unsigned char *buf, l
fcfc58
 
fcfc58
     if (n > idx->count - 1) {
fcfc58
         normal_warning("cff","top DICT not exist");
fcfc58
+        cff_release_index(idx);
fcfc58
         cff_close(cff);
fcfc58
         return NULL;
fcfc58
     }
fcfc58
@@ -1128,6 +1130,7 @@ cff_font *read_cff(unsigned char *buf, l
fcfc58
                                    idx->data + idx->offset[n + 1] - 1);
fcfc58
     if (!cff->topdict) {
fcfc58
         normal_warning("cff","parsing top DICT data failed");
fcfc58
+        cff_release_index(idx);
fcfc58
         cff_close(cff);
fcfc58
         return NULL;
fcfc58
     }
fcfc58
@@ -3037,6 +3040,7 @@ cffont->_string = NULL;
fcfc58
             pdf_out_block(pdf, stream, l);
fcfc58
             pdf_end_stream(pdf);
fcfc58
             pdf_end_obj(pdf);
fcfc58
+            free(stream);
fcfc58
         }
fcfc58
     }
fcfc58
     /*
fcfc58
diff -up texlive-20180414/source/texk/web2c/luatexdir/font/writetype2.w.me texlive-20180414/source/texk/web2c/luatexdir/font/writetype2.w
fcfc58
--- texlive-20180414/source/texk/web2c/luatexdir/font/writetype2.w.me	2018-10-04 16:13:09.614046152 +0100
fcfc58
+++ texlive-20180414/source/texk/web2c/luatexdir/font/writetype2.w	2018-10-04 16:13:43.084667255 +0100
fcfc58
@@ -406,6 +406,7 @@ boolean make_tt_subset(PDF pdf, fd_entry
fcfc58
                 pdf_out_block(pdf, stream, l);
fcfc58
                 pdf_end_stream(pdf);
fcfc58
                 pdf_end_obj(pdf);
fcfc58
+                free(stream);
fcfc58
             }
fcfc58
         }
fcfc58
     }