Patch 8.2.1507

11 views
Skip to first unread message

Bram Moolenaar

unread,
Aug 22, 2020, 9:20:13 AM8/22/20
to vim...@googlegroups.com

Patch 8.2.1507
Problem: Using malloc() directly.
Solution: Use ALLOC_ONE(). Remove superfluous typecast. (Hussam al-Homsi,
closes #6768)
Files: src/eval.c, src/memline.c, src/vimrun.c


*** ../vim-8.2.1506/src/eval.c 2020-08-20 22:29:05.445693718 +0200
--- src/eval.c 2020-08-22 15:09:38.567372877 +0200
***************
*** 4352,4358 ****
}
else
{
! ht_stack_T *newitem = (ht_stack_T*)malloc(sizeof(ht_stack_T));
if (newitem == NULL)
abort = TRUE;
else
--- 4352,4359 ----
}
else
{
! ht_stack_T *newitem = ALLOC_ONE(ht_stack_T);
!
if (newitem == NULL)
abort = TRUE;
else
***************
*** 4378,4385 ****
}
else
{
! list_stack_T *newitem = (list_stack_T*)malloc(
! sizeof(list_stack_T));
if (newitem == NULL)
abort = TRUE;
else
--- 4379,4386 ----
}
else
{
! list_stack_T *newitem = ALLOC_ONE(list_stack_T);
!
if (newitem == NULL)
abort = TRUE;
else
*** ../vim-8.2.1506/src/memline.c 2020-07-15 15:30:02.457232762 +0200
--- src/memline.c 2020-08-22 15:13:03.942332221 +0200
***************
*** 5448,5455 ****
chunksize_T *t_chunksize = buf->b_ml.ml_chunksize;

buf->b_ml.ml_numchunks = buf->b_ml.ml_numchunks * 3 / 2;
! buf->b_ml.ml_chunksize = (chunksize_T *)
! vim_realloc(buf->b_ml.ml_chunksize,
sizeof(chunksize_T) * buf->b_ml.ml_numchunks);
if (buf->b_ml.ml_chunksize == NULL)
{
--- 5448,5454 ----
chunksize_T *t_chunksize = buf->b_ml.ml_chunksize;

buf->b_ml.ml_numchunks = buf->b_ml.ml_numchunks * 3 / 2;
! buf->b_ml.ml_chunksize = vim_realloc(buf->b_ml.ml_chunksize,
sizeof(chunksize_T) * buf->b_ml.ml_numchunks);
if (buf->b_ml.ml_chunksize == NULL)
{
*** ../vim-8.2.1506/src/vimrun.c 2019-10-05 12:07:58.000000000 +0200
--- src/vimrun.c 2020-08-22 15:18:40.124747523 +0200
***************
*** 77,83 ****
if (cmdlen >= 2 && p[0] == L'"' && p[cmdlen - 1] == L'"')
{
cmdlen += 3;
! cmd = (wchar_t *)malloc(cmdlen * sizeof(wchar_t));
if (cmd == NULL)
{
perror("vimrun malloc(): ");
--- 77,83 ----
if (cmdlen >= 2 && p[0] == L'"' && p[cmdlen - 1] == L'"')
{
cmdlen += 3;
! cmd = malloc(cmdlen * sizeof(wchar_t));
if (cmd == NULL)
{
perror("vimrun malloc(): ");
*** ../vim-8.2.1506/src/version.c 2020-08-22 15:06:29.420409081 +0200
--- src/version.c 2020-08-22 15:14:19.221966826 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1507,
/**/

--
hundred-and-one symptoms of being an internet addict:
264. You turn to the teletext page "surfing report" and are surprised that it
is about sizes of waves and a weather forecast for seaside resorts.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages