Blob Blame Raw
diff -up a2ps-4.14/lib/encoding.c.resource-leak a2ps-4.14/lib/encoding.c
--- a2ps-4.14/lib/encoding.c.resource-leak	2011-08-10 16:02:26.244905923 +0100
+++ a2ps-4.14/lib/encoding.c	2011-08-10 16:41:39.578353192 +0100
@@ -554,7 +554,7 @@ encoding_resolve_font_substitute (struct
   if (!res)
     {
       if (encoding->default_font)
-	res = encoding->default_font;
+	res = xstrdup (encoding->default_font);
       else
 	error (1, 0, "Cannot find font %s, nor any substitute",
 	       font_name);
@@ -976,6 +976,7 @@ dump_encoding_setup (FILE * stream,
 							 font_names [i]);
       if (!font_is_to_reencode (job, real_font_name))
 	da_remove_at (encoding->font_names_used, i, (da_map_func_t) free);
+      free (real_font_name);
     }
 
   /* The number of fonts that, finally, have to be encoded
@@ -992,10 +993,16 @@ dump_encoding_setup (FILE * stream,
   fprintf (stream, "/%sdict %d dict begin\n", encoding->key,
 	   (encoding->composite_flag == true)? nb+nb+ns:nb+ns);
   for (i = 0 ; i < nb ; i++)
-    fprintf (stream, "  /f%s %sEncoding /%s reencode_font\n",
-	     font_names [i],
-	     encoding->name,
-	     encoding_resolve_font_substitute (job, encoding, font_names [i]));
+    {
+      char *real_font = encoding_resolve_font_substitute (job, encoding,
+							  font_names [i]);
+      fprintf (stream, "  /f%s %sEncoding /%s reencode_font\n",
+	       font_names [i],
+	       encoding->name,
+	       real_font);
+      free (real_font);
+    }
+	     
 
   /* Slant font setting */
   for (i = 0 ; encoding->slantfont[i].name ; i++ )
@@ -1166,6 +1173,7 @@ encoding_build_faces_wx (a2ps_job * job,
 				   encoding->vector,
 				   encoding->faces_wx [face]);
 
+      free (true_font_name);
       if (encoding->composite_flag)
 	{
 	  encoding->composite_raito[i] =