To: vim_dev@googlegroups.com Subject: Patch 8.2.0716 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0716 Problem: Vim9: another memory leak. Solution: Clear typval when failing. Files: src/vim9compile.c *** ../vim-8.2.0715/src/vim9compile.c 2020-05-07 22:23:54.595870368 +0200 --- src/vim9compile.c 2020-05-07 23:18:21.023871481 +0200 *************** *** 4074,4085 **** return FAIL; } if (compile_subscript(arg, cctx, &start_leader, end_leader, ! bef1_tv, bef2_tv, new_tv) == FAIL) return FAIL; ! ! // Now deal with prefixed '-', '+' and '!', if not done already. ! return compile_leader(cctx, start_leader, end_leader); } /* --- 4074,4089 ---- return FAIL; } + // Handle following "[]", ".member", etc. + // Then deal with prefixed '-', '+' and '!', if not done already. if (compile_subscript(arg, cctx, &start_leader, end_leader, ! bef1_tv, bef2_tv, new_tv) == FAIL ! || compile_leader(cctx, start_leader, end_leader) == FAIL) ! { ! clear_tv(new_tv); return FAIL; ! } ! return OK; } /* *************** *** 4187,4192 **** --- 4191,4197 ---- { char_u buf[3]; + clear_tv(&tv1); vim_strncpy(buf, op, oplen); semsg(_(e_white_both), buf); return FAIL; *************** *** 4194,4205 **** --- 4199,4216 ---- *arg = skipwhite(op + oplen); if (may_get_next_line(op + oplen, arg, cctx) == FAIL) + { + clear_tv(&tv1); return FAIL; + } // get the second expression tv2.v_type = VAR_UNKNOWN; if (compile_expr6(arg, cctx, &tv1, &tv2) == FAIL) + { + clear_tv(&tv1); return FAIL; + } if (*op == '+' && tv1.v_type == VAR_NUMBER && tv2.v_type == VAR_NUMBER) { *** ../vim-8.2.0715/src/version.c 2020-05-07 22:23:54.595870368 +0200 --- src/version.c 2020-05-07 23:19:11.367684388 +0200 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 716, /**/ -- hundred-and-one symptoms of being an internet addict: 67. Your hard drive crashes. You haven't logged in for two hours. You start to twitch. You pick up the phone and manually dial your ISP's access number. You try to hum to communicate with the modem. You succeed. /// 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 ///