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