summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1186
blob: 624be447d9254093c8f213c20e8bac9ae78d6286 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1186
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.1186
Problem:    readdir() allocates list twice.
Solution:   Remove second allocation.  Also check for zero length.
Files:	    src/evalfunc.c


*** ../vim-8.1.1185/src/evalfunc.c	2019-04-08 20:01:42.877179442 +0200
--- src/evalfunc.c	2019-04-19 15:20:22.221545619 +0200
***************
*** 9324,9333 ****
      }
  #endif
  
!     rettv->vval.v_list = list_alloc();
!     if (!failed && rettv->vval.v_list != NULL)
      {
- 	++rettv->vval.v_list->lv_refcount;
  	sort_strings((char_u **)ga.ga_data, ga.ga_len);
  	for (i = 0; i < ga.ga_len; i++)
  	{
--- 9324,9331 ----
      }
  #endif
  
!     if (!failed && rettv->vval.v_list != NULL && ga.ga_len > 0)
      {
  	sort_strings((char_u **)ga.ga_data, ga.ga_len);
  	for (i = 0; i < ga.ga_len; i++)
  	{
***************
*** 9335,9344 ****
  	    list_append_string(rettv->vval.v_list, p, -1);
  	}
      }
!     for (i = 0; i < ga.ga_len; i++)
! 	vim_free(((char_u **)ga.ga_data)[i]);
! 
!     ga_clear(&ga);
  }
  
  /*
--- 9333,9339 ----
  	    list_append_string(rettv->vval.v_list, p, -1);
  	}
      }
!     ga_clear_strings(&ga);
  }
  
  /*
*** ../vim-8.1.1185/src/version.c	2019-04-18 21:08:46.841176544 +0200
--- src/version.c	2019-04-19 15:19:45.857716573 +0200
***************
*** 773,774 ****
--- 773,776 ----
  {   /* Add new patch number below this line */
+ /**/
+     1186,
  /**/

-- 
"Intelligence has much less practical application than you'd think."
		  -- Scott Adams, Dilbert.

 /// Bram Moolenaar -- Bram@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    ///