Mercurial > vim
comparison src/vim9compile.c @ 26845:a6ccb6ec581c v8.2.3951
patch 8.2.3951: Vim9: memory leak when text after a nested function
Commit: https://github.com/vim/vim/commit/d293981d2b76b40013143fe2302b910585e50808
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Dec 30 17:09:05 2021 +0000
patch 8.2.3951: Vim9: memory leak when text after a nested function
Problem: Vim9: memory leak when text after a nested function.
Solution: Free the function if text is found after "enddef".
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 30 Dec 2021 18:15:03 +0100 |
parents | 30d8377ea1b1 |
children | 15913ba6363e |
comparison
equal
deleted
inserted
replaced
26844:90ab085d8d8f | 26845:a6ccb6ec581c |
---|---|
887 if (eap->nextcmd != NULL) | 887 if (eap->nextcmd != NULL) |
888 { | 888 { |
889 semsg(_(e_text_found_after_str_str), | 889 semsg(_(e_text_found_after_str_str), |
890 eap->cmdidx == CMD_def ? "enddef" : "endfunction", eap->nextcmd); | 890 eap->cmdidx == CMD_def ? "enddef" : "endfunction", eap->nextcmd); |
891 r = FAIL; | 891 r = FAIL; |
892 func_ptr_unref(ufunc); | |
892 goto theend; | 893 goto theend; |
893 } | 894 } |
894 | 895 |
895 // copy over the block scope IDs before compiling | 896 // copy over the block scope IDs before compiling |
896 if (!is_global && cctx->ctx_ufunc->uf_block_depth > 0) | 897 if (!is_global && cctx->ctx_ufunc->uf_block_depth > 0) |