To: vim_dev@googlegroups.com
Subject: Patch 7.4.533
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.4.533
Problem: ":hardcopy" leaks memory in case of errors.
Solution: Free memory in all code paths. (Christian Brabandt)
Files: src/hardcopy.c
*** ../vim-7.4.532/src/hardcopy.c 2013-05-06 04:00:47.000000000 +0200
--- src/hardcopy.c 2014-11-27 17:35:48.418285820 +0100
***************
*** 2960,2971 ****
if (!prt_find_resource("prolog", res_prolog))
{
EMSG(_("E456: Can't find PostScript resource file \"prolog.ps\""));
! return FALSE;
}
if (!prt_open_resource(res_prolog))
! return FALSE;
if (!prt_check_resource(res_prolog, PRT_PROLOG_VERSION))
! return FALSE;
#ifdef FEAT_MBYTE
if (prt_out_mbyte)
{
--- 2960,2971 ----
if (!prt_find_resource("prolog", res_prolog))
{
EMSG(_("E456: Can't find PostScript resource file \"prolog.ps\""));
! goto theend;
}
if (!prt_open_resource(res_prolog))
! goto theend;
if (!prt_check_resource(res_prolog, PRT_PROLOG_VERSION))
! goto theend;
#ifdef FEAT_MBYTE
if (prt_out_mbyte)
{
***************
*** 2973,2984 ****
if (!prt_find_resource("cidfont", res_cidfont))
{
EMSG(_("E456: Can't find PostScript resource file \"cidfont.ps\""));
! return FALSE;
}
if (!prt_open_resource(res_cidfont))
! return FALSE;
if (!prt_check_resource(res_cidfont, PRT_CID_PROLOG_VERSION))
! return FALSE;
}
#endif
--- 2973,2984 ----
if (!prt_find_resource("cidfont", res_cidfont))
{
EMSG(_("E456: Can't find PostScript resource file \"cidfont.ps\""));
! goto theend;
}
if (!prt_open_resource(res_cidfont))
! goto theend;
if (!prt_check_resource(res_cidfont, PRT_CID_PROLOG_VERSION))
! goto theend;
}
#endif
***************
*** 3012,3023 ****
{
EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""),
p_encoding);
! return FALSE;
}
}
}
if (!prt_open_resource(res_encoding))
! return FALSE;
/* For the moment there are no checks on encoding resource files to
* perform */
#ifdef FEAT_MBYTE
--- 3012,3023 ----
{
EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""),
p_encoding);
! goto theend;
}
}
}
if (!prt_open_resource(res_encoding))
! goto theend;
/* For the moment there are no checks on encoding resource files to
* perform */
#ifdef FEAT_MBYTE
***************
*** 3034,3043 ****
{
EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""),
prt_ascii_encoding);
! return FALSE;
}
if (!prt_open_resource(res_encoding))
! return FALSE;
/* For the moment there are no checks on encoding resource files to
* perform */
}
--- 3034,3043 ----
{
EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""),
prt_ascii_encoding);
! goto theend;
}
if (!prt_open_resource(res_encoding))
! goto theend;
/* For the moment there are no checks on encoding resource files to
* perform */
}
***************
*** 3050,3056 ****
{
EMSG2(_("E620: Unable to convert to print encoding \"%s\""),
p_encoding);
! return FALSE;
}
prt_do_conv = TRUE;
}
--- 3050,3056 ----
{
EMSG2(_("E620: Unable to convert to print encoding \"%s\""),
p_encoding);
! goto theend;
}
prt_do_conv = TRUE;
}
***************
*** 3063,3072 ****
{
EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""),
prt_cmap);
! return FALSE;
}
if (!prt_open_resource(res_cmap))
! return FALSE;
}
#endif
--- 3063,3072 ----
{
EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""),
prt_cmap);
! goto theend;
}
if (!prt_open_resource(res_cmap))
! goto theend;
}
#endif
***************
*** 3140,3154 ****
/* Add required procsets - NOTE: order is important! */
if (!prt_add_resource(res_prolog))
! return FALSE;
#ifdef FEAT_MBYTE
if (prt_out_mbyte)
{
/* Add CID font procset, and any user supplied CMap */
if (!prt_add_resource(res_cidfont))
! return FALSE;
if (prt_custom_cmap && !prt_add_resource(res_cmap))
! return FALSE;
}
#endif
--- 3140,3154 ----
/* Add required procsets - NOTE: order is important! */
if (!prt_add_resource(res_prolog))
! goto theend;
#ifdef FEAT_MBYTE
if (prt_out_mbyte)
{
/* Add CID font procset, and any user supplied CMap */
if (!prt_add_resource(res_cidfont))
! goto theend;
if (prt_custom_cmap && !prt_add_resource(res_cmap))
! goto theend;
}
#endif
***************
*** 3158,3164 ****
/* There will be only one Roman font encoding to be included in the PS
* file. */
if (!prt_add_resource(res_encoding))
! return FALSE;
prt_dsc_noarg("EndProlog");
--- 3158,3164 ----
/* There will be only one Roman font encoding to be included in the PS
* file. */
if (!prt_add_resource(res_encoding))
! goto theend;
prt_dsc_noarg("EndProlog");
*** ../vim-7.4.532/src/version.c 2014-11-27 17:29:52.770188864 +0100
--- src/version.c 2014-11-27 17:32:56.636171921 +0100
***************
*** 743,744 ****
--- 743,746 ----
{ /* Add new patch number below this line */
+ /**/
+ 533,
/**/
--
People who want to share their religious views with you
almost never want you to share yours with them.
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///