comparison src/vim9execute.c @ 30092:53e7e912eeec v9.0.0382

patch 9.0.0382: freeing the wrong string on failure Commit: https://github.com/vim/vim/commit/31ea6bf530a814991f669122dbc9921117a862c3 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Sep 5 10:47:13 2022 +0100 patch 9.0.0382: freeing the wrong string on failure Problem: Freeing the wrong string on failure. Solution: Adjust the argument. Reorder the code.
author Bram Moolenaar <Bram@vim.org>
date Mon, 05 Sep 2022 12:00:06 +0200
parents a542dfb1c1a2
children 458162398682
comparison
equal deleted inserted replaced
30091:44d3ef8599bc 30092:53e7e912eeec
935 int i; 935 int i;
936 936
937 if (dfunc->df_defer_var_idx == 0) 937 if (dfunc->df_defer_var_idx == 0)
938 { 938 {
939 iemsg("df_defer_var_idx is zero"); 939 iemsg("df_defer_var_idx is zero");
940 vim_free(func_tv.vval.v_string); 940 vim_free(name);
941 return FAIL; 941 return FAIL;
942 } 942 }
943
944 l = add_defer_item(dfunc->df_defer_var_idx - 1, 1, current_ectx);
945 if (l == NULL)
946 {
947 vim_free(name);
948 return FAIL;
949 }
950
943 func_tv.v_type = VAR_FUNC; 951 func_tv.v_type = VAR_FUNC;
944 func_tv.v_lock = 0; 952 func_tv.v_lock = 0;
945 func_tv.vval.v_string = name; 953 func_tv.vval.v_string = name;
946
947 l = add_defer_item(dfunc->df_defer_var_idx - 1, 1, current_ectx);
948 if (l == NULL)
949 {
950 vim_free(func_tv.vval.v_string);
951 return FAIL;
952 }
953
954 list_set_item(l, 0, &func_tv); 954 list_set_item(l, 0, &func_tv);
955
955 for (i = 0; i < argcount; ++i) 956 for (i = 0; i < argcount; ++i)
956 list_set_item(l, i + 1, argvars + i); 957 list_set_item(l, i + 1, argvars + i);
957 return OK; 958 return OK;
958 } 959 }
959 960