To: vim_dev@googlegroups.com Subject: Patch 9.0.0382 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0382 Problem: Freeing the wrong string on failure. Solution: Adjust the argument. Reorder the code. Files: src/vim9execute.c *** ../vim-9.0.0381/src/vim9execute.c 2022-09-04 15:40:31.816188110 +0100 --- src/vim9execute.c 2022-09-05 10:45:34.840315928 +0100 *************** *** 937,957 **** if (dfunc->df_defer_var_idx == 0) { iemsg("df_defer_var_idx is zero"); ! vim_free(func_tv.vval.v_string); return FAIL; } - func_tv.v_type = VAR_FUNC; - func_tv.v_lock = 0; - func_tv.vval.v_string = name; l = add_defer_item(dfunc->df_defer_var_idx - 1, 1, current_ectx); if (l == NULL) { ! vim_free(func_tv.vval.v_string); return FAIL; } list_set_item(l, 0, &func_tv); for (i = 0; i < argcount; ++i) list_set_item(l, i + 1, argvars + i); return OK; --- 937,958 ---- if (dfunc->df_defer_var_idx == 0) { iemsg("df_defer_var_idx is zero"); ! vim_free(name); return FAIL; } l = add_defer_item(dfunc->df_defer_var_idx - 1, 1, current_ectx); if (l == NULL) { ! vim_free(name); return FAIL; } + func_tv.v_type = VAR_FUNC; + func_tv.v_lock = 0; + func_tv.vval.v_string = name; list_set_item(l, 0, &func_tv); + for (i = 0; i < argcount; ++i) list_set_item(l, i + 1, argvars + i); return OK; *** ../vim-9.0.0381/src/version.c 2022-09-04 21:29:41.556536007 +0100 --- src/version.c 2022-09-05 10:46:52.344286229 +0100 *************** *** 705,706 **** --- 705,708 ---- { /* Add new patch number below this line */ + /**/ + 382, /**/ -- All good vision statements are created by groups of people with bloated bladders who would rather be doing anything else. (Scott Adams - The Dilbert principle) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///