Mercurial > vim
changeset 18243:463da8586749 v8.1.2116
patch 8.1.2116: no check for out of memory
Commit: https://github.com/vim/vim/commit/1671de3098b7ab663398dd694b314e7f67a93411
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Oct 5 21:35:16 2019 +0200
patch 8.1.2116: no check for out of memory
Problem: No check for out of memory.
Solution: Check for NULL pointer.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 05 Oct 2019 21:45:04 +0200 |
parents | 0d7e8480d1c5 |
children | 59abcab3e712 |
files | src/option.c src/version.c |
diffstat | 2 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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);