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