forked from aniani/vim
patch 8.1.2116: no check for out of memory
Problem: No check for out of memory. Solution: Check for NULL pointer.
This commit is contained in:
@@ -112,9 +112,12 @@ set_init_1(int clean_arg)
|
||||
{
|
||||
len = STRLEN(p) + 3; // two quotes and a trailing NUL
|
||||
cmd = alloc(len);
|
||||
vim_snprintf((char *)cmd, len, "\"%s\"", p);
|
||||
set_string_default("sh", cmd);
|
||||
vim_free(cmd);
|
||||
if (cmd != NULL)
|
||||
{
|
||||
vim_snprintf((char *)cmd, len, "\"%s\"", p);
|
||||
set_string_default("sh", cmd);
|
||||
vim_free(cmd);
|
||||
}
|
||||
}
|
||||
else
|
||||
set_string_default("sh", p);
|
||||
|
Reference in New Issue
Block a user