comparison src/userfunc.c @ 9727:8436bb5134f5 v7.4.2139

commit https://github.com/vim/vim/commit/0588d4f9d2741f35a271400a37fddbdd72d84219 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Aug 1 16:29:47 2016 +0200 patch 7.4.2139 Problem: :delfunction causes illegal memory access. Solution: Correct logic when deciding to free a function.
author Christian Brabandt <cb@256bit.org>
date Mon, 01 Aug 2016 16:30:07 +0200
parents 80ac9cf77c9b
children f85d94eee05b
comparison
equal deleted inserted replaced
9726:45d404749bb0 9727:8436bb5134f5
2709 * refcount of 1 for the entry in the hashtable. When deleting 2709 * refcount of 1 for the entry in the hashtable. When deleting
2710 * them and the refcount is more than one, it should be kept. 2710 * them and the refcount is more than one, it should be kept.
2711 * Numbered functions and lambdas snould be kept if the refcount is 2711 * Numbered functions and lambdas snould be kept if the refcount is
2712 * one or more. */ 2712 * one or more. */
2713 if (fp->uf_refcount > (isdigit(fp->uf_name[0]) 2713 if (fp->uf_refcount > (isdigit(fp->uf_name[0])
2714 || fp->uf_name[0] == '<') ? 0 : 1) 2714 || fp->uf_name[0] == '<' ? 0 : 1))
2715 { 2715 {
2716 /* Function is still referenced somewhere. Don't free it but 2716 /* Function is still referenced somewhere. Don't free it but
2717 * do remove it from the hashtable. */ 2717 * do remove it from the hashtable. */
2718 func_remove(fp); 2718 func_remove(fp);
2719 fp->uf_flags |= FC_DELETED; 2719 fp->uf_flags |= FC_DELETED;