summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1010
blob: 707e5923b689d57584610789b37d63bdb05c9cf2 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1010
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.1010
Problem:    Lua interface leaks memory.
Solution:   Clear typeval after copying it.
Files:	    src/if_lua.c


*** ../vim-8.1.1009/src/if_lua.c	2019-02-17 17:44:36.211875510 +0100
--- src/if_lua.c	2019-03-16 16:37:33.641028413 +0100
***************
*** 844,853 ****
      lua_settop(L, 2);
      luaV_checktypval(L, 2, &v, "adding list item");
      if (list_append_tv(l, &v) == FAIL)
-     {
- 	clear_tv(&v);
  	luaL_error(L, "failed to add item to list");
-     }
      clear_tv(&v);
      lua_settop(L, 1);
      return 1;
--- 844,850 ----
***************
*** 872,881 ****
      lua_settop(L, 2);
      luaV_checktypval(L, 2, &v, "inserting list item");
      if (list_insert_tv(l, &v, li) == FAIL)
-     {
- 	clear_tv(&v);
  	luaL_error(L, "failed to add item to list");
-     }
      clear_tv(&v);
      lua_settop(L, 1);
      return 1;
--- 869,875 ----
***************
*** 981,986 ****
--- 975,981 ----
      char_u *key = (char_u *) luaL_checkstring(L, 2);
      dictitem_T *di;
      typval_T v;
+ 
      if (d->dv_lock)
  	luaL_error(L, "dict is locked");
      if (key == NULL)
***************
*** 1104,1109 ****
--- 1099,1105 ----
  	{
  	    luaV_checktypval(L, i + 2, &v, "calling funcref");
  	    list_append_tv(f->args.vval.v_list, &v);
+ 	    clear_tv(&v);
  	}
  	status = func_call(f->tv.vval.v_string, &f->args,
  							NULL, f->self, &rettv);
***************
*** 1571,1576 ****
--- 1567,1573 ----
  		{
  		    luaV_checktypval(L, -1, &v, "vim.list");
  		    list_append_tv(l, &v);
+ 		    clear_tv(&v);
  		}
  		lua_pop(L, 1); /* value */
  	    } while (notnil);
*** ../vim-8.1.1009/src/version.c	2019-03-16 15:24:39.333662581 +0100
--- src/version.c	2019-03-16 16:38:26.984716746 +0100
***************
*** 781,782 ****
--- 781,784 ----
  {   /* Add new patch number below this line */
+ /**/
+     1010,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
66. You create a homepage with the impression to cure the afflicted...but
    your hidden agenda is to receive more e-mail.

 /// 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    ///