To: vim_dev@googlegroups.com Subject: Patch 8.1.1010 Fcc: outbox From: Bram Moolenaar 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 ///