0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.1.1894: not checking for out-of-memory of autoload_name()

Problem:    Not checking for out-of-memory of autoload_name().
Solution:   Check for NULL. (Dominique Pelle, closes #4846)
This commit is contained in:
Bram Moolenaar
2019-08-20 21:58:00 +02:00
parent f1e0544d41
commit 1058c9d9b5
2 changed files with 5 additions and 1 deletions

View File

@@ -9439,7 +9439,7 @@ autoload_name(char_u *name)
// Get the script file name: replace '#' with '/', append ".vim".
scriptname = alloc(STRLEN(name) + 14);
if (scriptname == NULL)
return FALSE;
return NULL;
STRCPY(scriptname, "autoload/");
STRCAT(scriptname, name);
for (p = scriptname + 9; (p = vim_strchr(p, AUTOLOAD_CHAR)) != NULL;
@@ -9469,6 +9469,8 @@ script_autoload(
return FALSE;
tofree = scriptname = autoload_name(name);
if (scriptname == NULL)
return FALSE;
/* Find the name in the list of previously loaded package names. Skip
* "autoload/", it's always the same. */