diff options
author | Lewis Russell <lewis6991@gmail.com> | 2023-04-22 08:51:02 +0100 |
---|---|---|
committer | Lewis Russell <lewis6991@gmail.com> | 2023-04-22 11:02:16 +0100 |
commit | 4d7a8b47b96927f475634c3116ced06acbb600b5 (patch) | |
tree | 4591e22e0288862210e1975c9ab6455cf9c26974 | |
parent | a093c66bcd5c7aadd7073cb88695328bcf15360f (diff) | |
download | rneovim-4d7a8b47b96927f475634c3116ced06acbb600b5.tar.gz rneovim-4d7a8b47b96927f475634c3116ced06acbb600b5.tar.bz2 rneovim-4d7a8b47b96927f475634c3116ced06acbb600b5.zip |
vim-patch:9.0.1311: Coverity warns for using a NULL pointer
Problem: Coverity warns for using a NULL pointer.
Solution: Use "empty_option" instead of NULL.
https://github.com/vim/vim/commit/339e114d70de3ec2b36edf37d7ba7a7cfdf9d1a6
N/A patches for version.c:
vim-patch:9.0.1405: missing check for out-of-memory
Problem: Missing check for out-of-memory.
Solution: Check for alloc() returning NULL pointer. (closes vim/vim#12149)
https://github.com/vim/vim/commit/14338024c131b71a337c2bb87cb5904f5a5782b8
-rw-r--r-- | src/nvim/option.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index e6b41d63d0..69e7bb4b21 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -1207,6 +1207,9 @@ static void do_set_option_string(int opt_idx, int opt_flags, char **argp, int ne // Set the new value. *(char **)(varp) = newval; + if (newval == NULL) { + *(char **)(varp) = empty_option; + } // origval may be freed by did_set_string_option(), make a copy. char *saved_origval = (origval != NULL) ? xstrdup(origval) : NULL; |