Bram,
there is a memory leak in hardcopy.c in the function mch_print_begin()

In case of errors it returns early, without freeing the allocated 
memory.

Attached is a patch.

Best,
Christian
-- 
Windows 95 kann alles, wegen der 32 Bit.
Wenn ich 32 Bit getrunken habe, meine ich auch immer, ich könnte alles.
                -- T. Koschwitz

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/hardcopy.c b/src/hardcopy.c
--- a/src/hardcopy.c
+++ b/src/hardcopy.c
@@ -2960,12 +2960,12 @@ mch_print_begin(psettings)
     if (!prt_find_resource("prolog", res_prolog))
     {
 	EMSG(_("E456: Can't find PostScript resource file \"prolog.ps\""));
-	return FALSE;
+	goto theend;
     }
     if (!prt_open_resource(res_prolog))
-	return FALSE;
+	goto theend;
     if (!prt_check_resource(res_prolog, PRT_PROLOG_VERSION))
-	return FALSE;
+	goto theend;
 #ifdef FEAT_MBYTE
     if (prt_out_mbyte)
     {
@@ -2973,12 +2973,12 @@ mch_print_begin(psettings)
 	if (!prt_find_resource("cidfont", res_cidfont))
 	{
 	    EMSG(_("E456: Can't find PostScript resource file \"cidfont.ps\""));
-	    return FALSE;
+	    goto theend;
 	}
 	if (!prt_open_resource(res_cidfont))
-	    return FALSE;
+	    goto theend;
 	if (!prt_check_resource(res_cidfont, PRT_CID_PROLOG_VERSION))
-	    return FALSE;
+	    goto theend;
     }
 #endif
 
@@ -3012,12 +3012,12 @@ mch_print_begin(psettings)
 		{
 		    EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""),
 			    p_encoding);
-		    return FALSE;
+		    goto theend;
 		}
 	    }
 	}
 	if (!prt_open_resource(res_encoding))
-	    return FALSE;
+	    goto theend;
 	/* For the moment there are no checks on encoding resource files to
 	 * perform */
 #ifdef FEAT_MBYTE
@@ -3034,10 +3034,10 @@ mch_print_begin(psettings)
 	    {
 		EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""),
 							  prt_ascii_encoding);
-		return FALSE;
+		goto theend;
 	    }
 	    if (!prt_open_resource(res_encoding))
-		return FALSE;
+		goto theend;
 	    /* For the moment there are no checks on encoding resource files to
 	     * perform */
 	}
@@ -3050,7 +3050,7 @@ mch_print_begin(psettings)
 	{
 	    EMSG2(_("E620: Unable to convert to print encoding \"%s\""),
 		    p_encoding);
-	    return FALSE;
+	    goto theend;
 	}
 	prt_do_conv = TRUE;
     }
@@ -3063,10 +3063,10 @@ mch_print_begin(psettings)
 	{
 	    EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""),
 								    prt_cmap);
-	    return FALSE;
+	    goto theend;
 	}
 	if (!prt_open_resource(res_cmap))
-	    return FALSE;
+	    goto theend;
     }
 #endif
 
@@ -3146,9 +3146,9 @@ mch_print_begin(psettings)
     {
 	/* Add CID font procset, and any user supplied CMap */
 	if (!prt_add_resource(res_cidfont))
-	    return FALSE;
+	    goto theend;
 	if (prt_custom_cmap && !prt_add_resource(res_cmap))
-	    return FALSE;
+	    goto theend;
     }
 #endif
 
@@ -3158,7 +3158,7 @@ mch_print_begin(psettings)
 	/* There will be only one Roman font encoding to be included in the PS
 	 * file. */
 	if (!prt_add_resource(res_encoding))
-	    return FALSE;
+	    goto theend;
 
     prt_dsc_noarg("EndProlog");
 

Raspunde prin e-mail lui