aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Vigouroux <thomas.vigouroux@protonmail.com>2022-06-24 08:05:42 +0200
committerThomas Vigouroux <thomas.vigouroux@protonmail.com>2022-06-24 09:41:13 +0200
commitfd3008a6aeba743080d0452b326e929786c57eb7 (patch)
tree723f36ed68a0eab49ad651f25dbd68f514cd98dc
parent7add9ea0e7c144bf30525e689f1e1806a4061b89 (diff)
downloadrneovim-fd3008a6aeba743080d0452b326e929786c57eb7.tar.gz
rneovim-fd3008a6aeba743080d0452b326e929786c57eb7.tar.bz2
rneovim-fd3008a6aeba743080d0452b326e929786c57eb7.zip
fix(coverity/348313): don't exit too early in runtime_default
-rw-r--r--src/nvim/runtime.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c
index 9f6d129392..28d85b54bd 100644
--- a/src/nvim/runtime.c
+++ b/src/nvim/runtime.c
@@ -1243,10 +1243,11 @@ char *runtimepath_default(bool clean_arg)
AFTER_SIZE + 1);
rtp_size += compute_double_env_sep_len(config_dirs, NVIM_SIZE + 1,
AFTER_SIZE + 1);
+ char *rtp = NULL;
if (rtp_size == 0) {
- return NULL;
+ goto freeall;
}
- char *const rtp = xmalloc(rtp_size);
+ rtp = xmalloc(rtp_size);
char *rtp_cur = rtp;
rtp_cur = add_dir(rtp_cur, config_home, config_len, kXDGConfigHome,
NULL, 0, NULL, 0);
@@ -1271,6 +1272,7 @@ char *runtimepath_default(bool clean_arg)
assert((size_t)(rtp_cur - rtp) == rtp_size);
#undef SITE_SIZE
#undef AFTER_SIZE
+freeall:
xfree(data_dirs);
xfree(config_dirs);
xfree(data_home);