Mercurial > vim
comparison src/buffer.c @ 17797:ec1717981acf v8.1.1895
patch 8.1.1895: using NULL pointer when out of memory
commit https://github.com/vim/vim/commit/6f10c70b59fa4e56aa479345fb0caeaac7429bfb
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Aug 20 22:58:37 2019 +0200
patch 8.1.1895: using NULL pointer when out of memory
Problem: Using NULL pointer when out of memory.
Solution: Bail out or skip the code using the pointer. (Zu-Ming Jiang,
closes #4805, closes #4843, closes #4939, closes #4844)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 20 Aug 2019 23:00:04 +0200 |
parents | 0f7ae8010787 |
children | 59f8948b7590 |
comparison
equal
deleted
inserted
replaced
17796:9ebba5c49827 | 17797:ec1717981acf |
---|---|
179 close_buffer(NULL, curbuf, 0, FALSE); | 179 close_buffer(NULL, curbuf, 0, FALSE); |
180 FOR_ALL_BUFFERS(curbuf) | 180 FOR_ALL_BUFFERS(curbuf) |
181 if (curbuf->b_ml.ml_mfp != NULL) | 181 if (curbuf->b_ml.ml_mfp != NULL) |
182 break; | 182 break; |
183 /* | 183 /* |
184 * if there is no memfile at all, exit | 184 * If there is no memfile at all, exit. |
185 * This is OK, since there are no changes to lose. | 185 * This is OK, since there are no changes to lose. |
186 */ | 186 */ |
187 if (curbuf == NULL) | 187 if (curbuf == NULL) |
188 { | 188 { |
189 emsg(_("E82: Cannot allocate any buffer, exiting...")); | 189 emsg(_("E82: Cannot allocate any buffer, exiting...")); |
190 | |
191 // Don't try to do any saving, with "curbuf" NULL almost nothing | |
192 // will work. | |
193 v_dying = 2; | |
190 getout(2); | 194 getout(2); |
191 } | 195 } |
196 | |
192 emsg(_("E83: Cannot allocate buffer, using other one...")); | 197 emsg(_("E83: Cannot allocate buffer, using other one...")); |
193 enter_buffer(curbuf); | 198 enter_buffer(curbuf); |
194 #ifdef FEAT_SYN_HL | 199 #ifdef FEAT_SYN_HL |
195 if (old_tw != curbuf->b_p_tw) | 200 if (old_tw != curbuf->b_p_tw) |
196 check_colorcolumn(curwin); | 201 check_colorcolumn(curwin); |