mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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.339e114d70
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)14338024c1
This commit is contained in:
parent
a093c66bcd
commit
4d7a8b47b9
@ -1207,6 +1207,9 @@ static void do_set_option_string(int opt_idx, int opt_flags, char **argp, int ne
|
|||||||
|
|
||||||
// Set the new value.
|
// Set the new value.
|
||||||
*(char **)(varp) = newval;
|
*(char **)(varp) = newval;
|
||||||
|
if (newval == NULL) {
|
||||||
|
*(char **)(varp) = empty_option;
|
||||||
|
}
|
||||||
|
|
||||||
// origval may be freed by did_set_string_option(), make a copy.
|
// origval may be freed by did_set_string_option(), make a copy.
|
||||||
char *saved_origval = (origval != NULL) ? xstrdup(origval) : NULL;
|
char *saved_origval = (origval != NULL) ? xstrdup(origval) : NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user