ba17896
To: vim-dev@vim.org
ba17896
Subject: Patch 7.2.317
ba17896
Fcc: outbox
ba17896
From: Bram Moolenaar <Bram@moolenaar.net>
ba17896
Mime-Version: 1.0
ba17896
Content-Type: text/plain; charset=UTF-8
ba17896
Content-Transfer-Encoding: 8bit
ba17896
------------
ba17896
ba17896
Patch 7.2.317
ba17896
Problem:    Memory leak when adding a highlight group with unprintable
ba17896
	    characters, resulting in E669.
ba17896
Solution:   Free the memory.  And fix a few typos. (Dominique Pelle)
ba17896
Files:	    src/syntax.c
ba17896
ba17896
ba17896
*** ../vim-7.2.316/src/syntax.c	2009-05-17 13:30:58.000000000 +0200
ba17896
--- src/syntax.c	2009-12-16 18:09:05.000000000 +0100
ba17896
***************
ba17896
*** 206,212 ****
ba17896
  static int current_attr = 0;	    /* attr of current syntax word */
ba17896
  #ifdef FEAT_EVAL
ba17896
  static int current_id = 0;	    /* ID of current char for syn_get_id() */
ba17896
! static int current_trans_id = 0;    /* idem, transparancy removed */
ba17896
  #endif
ba17896
  
ba17896
  typedef struct syn_cluster_S
ba17896
--- 206,212 ----
ba17896
  static int current_attr = 0;	    /* attr of current syntax word */
ba17896
  #ifdef FEAT_EVAL
ba17896
  static int current_id = 0;	    /* ID of current char for syn_get_id() */
ba17896
! static int current_trans_id = 0;    /* idem, transparency removed */
ba17896
  #endif
ba17896
  
ba17896
  typedef struct syn_cluster_S
ba17896
***************
ba17896
*** 282,288 ****
ba17896
      int		si_idx;			/* index of syntax pattern or
ba17896
  					   KEYWORD_IDX */
ba17896
      int		si_id;			/* highlight group ID for keywords */
ba17896
!     int		si_trans_id;		/* idem, transparancy removed */
ba17896
      int		si_m_lnum;		/* lnum of the match */
ba17896
      int		si_m_startcol;		/* starting column of the match */
ba17896
      lpos_T	si_m_endpos;		/* just after end posn of the match */
ba17896
--- 282,288 ----
ba17896
      int		si_idx;			/* index of syntax pattern or
ba17896
  					   KEYWORD_IDX */
ba17896
      int		si_id;			/* highlight group ID for keywords */
ba17896
!     int		si_trans_id;		/* idem, transparency removed */
ba17896
      int		si_m_lnum;		/* lnum of the match */
ba17896
      int		si_m_startcol;		/* starting column of the match */
ba17896
      lpos_T	si_m_endpos;		/* just after end posn of the match */
ba17896
***************
ba17896
*** 1274,1280 ****
ba17896
  	dist = syn_buf->b_ml.ml_line_count / (syn_buf->b_sst_len - Rows) + 1;
ba17896
  
ba17896
      /*
ba17896
!      * Go throught the list to find the "tick" for the oldest entry that can
ba17896
       * be removed.  Set "above" when the "tick" for the oldest entry is above
ba17896
       * "b_sst_lasttick" (the display tick wraps around).
ba17896
       */
ba17896
--- 1274,1280 ----
ba17896
  	dist = syn_buf->b_ml.ml_line_count / (syn_buf->b_sst_len - Rows) + 1;
ba17896
  
ba17896
      /*
ba17896
!      * Go through the list to find the "tick" for the oldest entry that can
ba17896
       * be removed.  Set "above" when the "tick" for the oldest entry is above
ba17896
       * "b_sst_lasttick" (the display tick wraps around).
ba17896
       */
ba17896
***************
ba17896
*** 2319,2325 ****
ba17896
  		    ? (syn_buf->b_spell_cluster_id == 0)
ba17896
  		    : (syn_buf->b_syn_spell == SYNSPL_TOP);
ba17896
  
ba17896
!     /* nextgroup ends at end of line, unless "skipnl" or "skipemtpy" present */
ba17896
      if (current_next_list != NULL
ba17896
  	    && syn_getcurline()[current_col + 1] == NUL
ba17896
  	    && !(current_next_flags & (HL_SKIPNL | HL_SKIPEMPTY)))
ba17896
--- 2319,2325 ----
ba17896
  		    ? (syn_buf->b_spell_cluster_id == 0)
ba17896
  		    : (syn_buf->b_syn_spell == SYNSPL_TOP);
ba17896
  
ba17896
!     /* nextgroup ends at end of line, unless "skipnl" or "skipempty" present */
ba17896
      if (current_next_list != NULL
ba17896
  	    && syn_getcurline()[current_col + 1] == NUL
ba17896
  	    && !(current_next_flags & (HL_SKIPNL | HL_SKIPEMPTY)))
ba17896
***************
ba17896
*** 6108,6114 ****
ba17896
      win_T	*wp;
ba17896
      long	lnum;
ba17896
      colnr_T	col;
ba17896
!     int		trans;	     /* remove transparancy */
ba17896
      int		*spellp;     /* return: can do spell checking */
ba17896
      int		keep_state;  /* keep state of char at "col" */
ba17896
  {
ba17896
--- 6108,6114 ----
ba17896
      win_T	*wp;
ba17896
      long	lnum;
ba17896
      colnr_T	col;
ba17896
!     int		trans;	     /* remove transparency */
ba17896
      int		*spellp;     /* return: can do spell checking */
ba17896
      int		keep_state;  /* keep state of char at "col" */
ba17896
  {
ba17896
***************
ba17896
*** 7523,7529 ****
ba17896
  #if defined(FEAT_GUI) || defined(PROTO)
ba17896
  /*
ba17896
   * Set the normal foreground and background colors according to the "Normal"
ba17896
!  * highlighighting group.  For X11 also set "Menu", "Scrollbar", and
ba17896
   * "Tooltip" colors.
ba17896
   */
ba17896
      void
ba17896
--- 7523,7529 ----
ba17896
  #if defined(FEAT_GUI) || defined(PROTO)
ba17896
  /*
ba17896
   * Set the normal foreground and background colors according to the "Normal"
ba17896
!  * highlighting group.  For X11 also set "Menu", "Scrollbar", and
ba17896
   * "Tooltip" colors.
ba17896
   */
ba17896
      void
ba17896
***************
ba17896
*** 8647,8652 ****
ba17896
--- 8647,8653 ----
ba17896
  	if (!vim_isprintc(*p))
ba17896
  	{
ba17896
  	    EMSG(_("E669: Unprintable character in group name"));
ba17896
+ 	    vim_free(name);
ba17896
  	    return 0;
ba17896
  	}
ba17896
  	else if (!ASCII_ISALNUM(*p) && *p != '_')
ba17896
*** ../vim-7.2.316/src/version.c	2009-12-16 17:14:08.000000000 +0100
ba17896
--- src/version.c	2009-12-16 18:09:14.000000000 +0100
ba17896
***************
ba17896
*** 683,684 ****
ba17896
--- 683,686 ----
ba17896
  {   /* Add new patch number below this line */
ba17896
+ /**/
ba17896
+     317,
ba17896
  /**/
ba17896
ba17896
-- 
ba17896
hundred-and-one symptoms of being an internet addict:
ba17896
35. Your husband tells you he's had the beard for 2 months.
ba17896
ba17896
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
ba17896
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
ba17896
\\\        download, build and distribute -- http://www.A-A-P.org        ///
ba17896
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///