Patch 8.2.4703

5 views
Skip to first unread message

Bram Moolenaar

unread,
Apr 7, 2022, 8:08:49 AM4/7/22
to vim...@googlegroups.com

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 -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages