Mercurial > vim
comparison src/option.c @ 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 | 85160a3649b9 |
children | 506bf60a30a0 |
comparison
equal
deleted
inserted
replaced
18242:0d7e8480d1c5 | 18243:463da8586749 |
---|---|
110 | 110 |
111 if (vim_strchr(p, ' ') != NULL) | 111 if (vim_strchr(p, ' ') != NULL) |
112 { | 112 { |
113 len = STRLEN(p) + 3; // two quotes and a trailing NUL | 113 len = STRLEN(p) + 3; // two quotes and a trailing NUL |
114 cmd = alloc(len); | 114 cmd = alloc(len); |
115 vim_snprintf((char *)cmd, len, "\"%s\"", p); | 115 if (cmd != NULL) |
116 set_string_default("sh", cmd); | 116 { |
117 vim_free(cmd); | 117 vim_snprintf((char *)cmd, len, "\"%s\"", p); |
118 set_string_default("sh", cmd); | |
119 vim_free(cmd); | |
120 } | |
118 } | 121 } |
119 else | 122 else |
120 set_string_default("sh", p); | 123 set_string_default("sh", p); |
121 } | 124 } |
122 #else | 125 #else |