Mercurial > vim
comparison src/vim9compile.c @ 24190:5f3a2d31c48d v8.2.2636
patch 8.2.2636: memory leak when compiling inline function
Commit: https://github.com/vim/vim/commit/67da21a14726b106b49744f9773eba132fedd5f2
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Mar 21 22:12:34 2021 +0100
patch 8.2.2636: memory leak when compiling inline function
Problem: Memory leak when compiling inline function.
Solution: Free the prefetched line.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 21 Mar 2021 22:15:03 +0100 |
parents | c20e763bc73c |
children | a7a9176bb542 |
comparison
equal
deleted
inserted
replaced
24189:60c5b6cb5130 | 24190:5f3a2d31c48d |
---|---|
3199 ++ufunc->uf_refcount; | 3199 ++ufunc->uf_refcount; |
3200 clear_tv(&rettv); | 3200 clear_tv(&rettv); |
3201 | 3201 |
3202 // Compile the function into instructions. | 3202 // Compile the function into instructions. |
3203 compile_def_function(ufunc, TRUE, PROFILING(ufunc), cctx); | 3203 compile_def_function(ufunc, TRUE, PROFILING(ufunc), cctx); |
3204 | |
3205 // evalarg.eval_tofree_cmdline may have a copy of the last line and "*arg" | |
3206 // points into it. Point to the original line to avoid a dangling pointer. | |
3207 if (evalarg.eval_tofree_cmdline != NULL) | |
3208 { | |
3209 size_t off = *arg - evalarg.eval_tofree_cmdline; | |
3210 | |
3211 *arg = ((char_u **)cctx->ctx_ufunc->uf_lines.ga_data)[cctx->ctx_lnum] | |
3212 + off; | |
3213 } | |
3204 | 3214 |
3205 clear_evalarg(&evalarg, NULL); | 3215 clear_evalarg(&evalarg, NULL); |
3206 | 3216 |
3207 if (ufunc->uf_def_status == UF_COMPILED) | 3217 if (ufunc->uf_def_status == UF_COMPILED) |
3208 { | 3218 { |