patch 8.1.2116: no check for out of memory
Problem: No check for out of memory.
Solution: Check for NULL pointer.
diff --git a/src/option.c b/src/option.c
index 75ff3cd..60c1141 100644
--- a/src/option.c
+++ b/src/option.c
@@ -112,9 +112,12 @@
{
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);