summaryrefslogtreecommitdiff
path: root/src/userfunc.c
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2023-03-07 17:45:11 +0000
committerBram Moolenaar <Bram@vim.org>2023-03-07 17:45:11 +0000
commit960dcbd098c761dd623bec9492d5391ff6e8dceb (patch)
treedf2abb6d73be0c31de679fa00251e133a0e99ab6 /src/userfunc.c
parent14113fdf9cb3d588c0d1c3a210246b981cf5aad3 (diff)
downloadvim-git-960dcbd098c761dd623bec9492d5391ff6e8dceb.tar.gz
patch 9.0.1391: "clear" macros are not always usedv9.0.1391
Problem: "clear" macros are not always used. Solution: Use ALLOC_ONE, VIM_CLEAR, CLEAR_POINTER and CLEAR_FIELD in more places. (Yegappan Lakshmanan, closes #12104)
Diffstat (limited to 'src/userfunc.c')
-rw-r--r--src/userfunc.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/userfunc.c b/src/userfunc.c
index 878e07f91..3885f67ad 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -5155,15 +5155,13 @@ define_function(
fudi.fd_di = dictitem_alloc(fudi.fd_newkey);
if (fudi.fd_di == NULL)
{
- vim_free(fp);
- fp = NULL;
+ VIM_CLEAR(fp);
goto erret;
}
if (dict_add(fudi.fd_dict, fudi.fd_di) == FAIL)
{
vim_free(fudi.fd_di);
- vim_free(fp);
- fp = NULL;
+ VIM_CLEAR(fp);
goto erret;
}
}
@@ -5292,10 +5290,7 @@ errret_2:
clear_type_list(&fp->uf_type_list);
}
if (free_fp)
- {
- vim_free(fp);
- fp = NULL;
- }
+ VIM_CLEAR(fp);
ret_free:
ga_clear_strings(&argtypes);
vim_free(fudi.fd_newkey);