comparison src/vim9compile.c @ 20534:ae758aa4ee5e v8.2.0821

patch 8.2.0821: Vim9: memory leak in expr test Commit: https://github.com/vim/vim/commit/45a1508a229b1d1d2eb79cabe55a183dc18fd040 Author: Bram Moolenaar <Bram@vim.org> Date: Mon May 25 00:28:33 2020 +0200 patch 8.2.0821: Vim9: memory leak in expr test Problem: Vim9: memory leak in expr test. Solution: Do not decrement the length of the list of functions if the current function is not at the end.
author Bram Moolenaar <Bram@vim.org>
date Mon, 25 May 2020 00:30:03 +0200
parents cb4831fa7e25
children 9f921ba86d05
comparison
equal deleted inserted replaced
20533:5ab9d71dc5f7 20534:ae758aa4ee5e
1441 arg_type_mismatch(expected, actual, i + 1); 1441 arg_type_mismatch(expected, actual, i + 1);
1442 return FAIL; 1442 return FAIL;
1443 } 1443 }
1444 } 1444 }
1445 if (ufunc->uf_dfunc_idx == UF_TO_BE_COMPILED) 1445 if (ufunc->uf_dfunc_idx == UF_TO_BE_COMPILED)
1446 if (compile_def_function(ufunc, TRUE, cctx) == FAIL) 1446 if (compile_def_function(ufunc, TRUE, NULL) == FAIL)
1447 return FAIL; 1447 return FAIL;
1448 } 1448 }
1449 1449
1450 if ((isn = generate_instr(cctx, 1450 if ((isn = generate_instr(cctx,
1451 ufunc->uf_dfunc_idx != UF_NOT_COMPILED ? ISN_DCALL 1451 ufunc->uf_dfunc_idx != UF_NOT_COMPILED ? ISN_DCALL
6774 6774
6775 for (idx = 0; idx < instr->ga_len; ++idx) 6775 for (idx = 0; idx < instr->ga_len; ++idx)
6776 delete_instr(((isn_T *)instr->ga_data) + idx); 6776 delete_instr(((isn_T *)instr->ga_data) + idx);
6777 ga_clear(instr); 6777 ga_clear(instr);
6778 6778
6779 // if using the last entry in the table we might as well remove it
6780 if (!dfunc->df_deleted
6781 && ufunc->uf_dfunc_idx == def_functions.ga_len - 1)
6782 --def_functions.ga_len;
6779 ufunc->uf_dfunc_idx = UF_NOT_COMPILED; 6783 ufunc->uf_dfunc_idx = UF_NOT_COMPILED;
6780 if (!dfunc->df_deleted)
6781 --def_functions.ga_len;
6782 6784
6783 while (cctx.ctx_scope != NULL) 6785 while (cctx.ctx_scope != NULL)
6784 drop_scope(&cctx); 6786 drop_scope(&cctx);
6785 6787
6786 // Don't execute this function body. 6788 // Don't execute this function body.