Patch 8.2.4703 (after 8.2.4702)
Problem:    Memory leak in handling 'cinscopedecls'.
Solution:   Free the memory before returning.
Files:      src/cindent.c


*** ../vim-8.2.4702/src/cindent.c       2022-04-07 12:39:03.983973910 +0100
--- src/cindent.c       2022-04-07 13:06:41.500496095 +0100
***************
*** 425,456 ****
      static int
  cin_isscopedecl(char_u *p)
  {
!     size_t cinsd_len;
!     char_u *cinsd_buf;
!     char_u *cinsd;
!     size_t len;
!     char_u *skip;
!     char_u *s = cin_skipcomment(p);
  
      cinsd_len = STRLEN(curbuf->b_p_cinsd) + 1;
      cinsd_buf = alloc(cinsd_len);
!     if (cinsd_buf != NULL)
      {
!       for (cinsd = curbuf->b_p_cinsd; *cinsd; )
        {
!           len = copy_option_part(&cinsd, cinsd_buf, cinsd_len, ",");
!           if (STRNCMP(s, cinsd_buf, len) == 0)
            {
!               skip = cin_skipcomment(s + len);
!               if (*skip == ':' && skip[1] != ':')
!                   return TRUE;
            }
        }
- 
-       vim_free(cinsd_buf);
      }
  
!     return FALSE;
  }
  
  /*
--- 425,459 ----
      static int
  cin_isscopedecl(char_u *p)
  {
!     size_t  cinsd_len;
!     char_u  *cinsd_buf;
!     char_u  *cinsd;
!     size_t  len;
!     char_u  *skip;
!     char_u  *s = cin_skipcomment(p);
!     int           found = FALSE;
  
      cinsd_len = STRLEN(curbuf->b_p_cinsd) + 1;
      cinsd_buf = alloc(cinsd_len);
!     if (cinsd_buf == NULL)
!       return FALSE;
! 
!     for (cinsd = curbuf->b_p_cinsd; *cinsd; )
      {
!       len = copy_option_part(&cinsd, cinsd_buf, cinsd_len, ",");
!       if (STRNCMP(s, cinsd_buf, len) == 0)
        {
!           skip = cin_skipcomment(s + len);
!           if (*skip == ':' && skip[1] != ':')
            {
!               found = TRUE;
!               break;
            }
        }
      }
  
!     vim_free(cinsd_buf);
!     return found;
  }
  
  /*
*** ../vim-8.2.4702/src/version.c       2022-04-07 12:39:03.987973874 +0100
--- src/version.c       2022-04-07 13:07:31.852349468 +0100
***************
*** 748,749 ****
--- 748,751 ----
  {   /* Add new patch number below this line */
+ /**/
+     4703,
  /**/

-- 
LETTERS TO THE EDITOR (The Times of London)

Dear Sir,

I am firmly opposed to the spread of microchips either to the home or
to the office.  We have more than enough of them foisted upon us in
public places.  They are a disgusting Americanism, and can only result
in the farmers being forced to grow smaller potatoes, which in turn
will cause massive unemployment in the already severely depressed
agricultural industry.

Yours faithfully,
        Capt. Quinton D'Arcy, J. P.
        Sevenoaks

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220407120844.219BE1C0917%40moolenaar.net.

Raspunde prin e-mail lui