diff options
author | Bram Moolenaar <Bram@vim.org> | 2023-01-01 14:11:27 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-01-01 14:11:27 +0000 |
commit | ec8b74f7ab37ac83045c9eba723daf3ff8d62fc2 (patch) | |
tree | c6f3abb7d5fc657685b7279a436599412aeb1cc4 | |
parent | 1aeb3eb092a384e63a407096102fd5a954aabeb8 (diff) | |
download | vim-git-9.0.1125.tar.gz |
patch 9.0.1125: memory leak when using class functionsv9.0.1125
Problem: Memory leak when using class functions.
Solution: Clear and free the array with class functions.
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim9class.c | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/version.c b/src/version.c index b49d71d8c..5688d0d7b 100644 --- a/src/version.c +++ b/src/version.c @@ -696,6 +696,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1125, +/**/ 1124, /**/ 1123, diff --git a/src/vim9class.c b/src/vim9class.c index b1de90b8b..b05dea8ef 100644 --- a/src/vim9class.c +++ b/src/vim9class.c @@ -975,6 +975,13 @@ class_unref(class_T *cl) } vim_free(cl->class_obj_members); + for (int i = 0; i < cl->class_class_function_count; ++i) + { + ufunc_T *uf = cl->class_class_functions[i]; + func_clear_free(uf, FALSE); + } + vim_free(cl->class_class_functions); + for (int i = 0; i < cl->class_obj_method_count; ++i) { ufunc_T *uf = cl->class_obj_methods[i]; |