]> granicus.if.org Git - vim/commitdiff
patch 8.1.2116: no check for out of memory v8.1.2116
authorBram Moolenaar <Bram@vim.org>
Sat, 5 Oct 2019 19:35:16 +0000 (21:35 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 5 Oct 2019 19:35:16 +0000 (21:35 +0200)
Problem:    No check for out of memory.
Solution:   Check for NULL pointer.

src/option.c
src/version.c

index 75ff3cdb2959aa397a68c48d949d91b9dfccddfd..60c1141b6a069fe5fdceecca647b0e87ee21ba3a 100644 (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);
index b1bccb4f6b15b64ce126318c4217aa3fc2df25c8..11bfd6844652f85195a42911f6d21091d27f311d 100644 (file)
@@ -753,6 +753,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2116,
 /**/
     2115,
 /**/