summaryrefslogtreecommitdiff
path: root/src/option.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-10-05 21:35:16 +0200
committerBram Moolenaar <Bram@vim.org>2019-10-05 21:35:16 +0200
commit1671de3098b7ab663398dd694b314e7f67a93411 (patch)
tree7c50130f4fc80e0c91bdb02798c459cca422456d /src/option.c
parent2efc44b3f0b6bd8307cb281af095e08e15ab1c24 (diff)
downloadvim-git-1671de3098b7ab663398dd694b314e7f67a93411.tar.gz
patch 8.1.2116: no check for out of memoryv8.1.2116
Problem: No check for out of memory. Solution: Check for NULL pointer.
Diffstat (limited to 'src/option.c')
-rw-r--r--src/option.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/option.c b/src/option.c
index 75ff3cdb2..60c1141b6 100644
--- a/src/option.c
+++ b/src/option.c
@@ -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);