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