1
0
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:
Bram Moolenaar
2019-10-05 21:35:16 +02:00
parent 2efc44b3f0
commit 1671de3098
2 changed files with 8 additions and 3 deletions

View File

@@ -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);