mirror of
https://github.com/vim/vim.git
synced 2025-10-07 05:54:16 -04:00
updated for version 7.4.624
Problem: May leak memory or crash when vim_realloc() returns NULL. Solution: Handle a NULL value properly. (Mike Williams)
This commit is contained in:
@@ -5057,6 +5057,8 @@ ml_updatechunk(buf, line, len, updtype)
|
||||
/* May resize here so we don't have to do it in both cases below */
|
||||
if (buf->b_ml.ml_usedchunks + 1 >= buf->b_ml.ml_numchunks)
|
||||
{
|
||||
chunksize_T *t_chunksize = buf->b_ml.ml_chunksize;
|
||||
|
||||
buf->b_ml.ml_numchunks = buf->b_ml.ml_numchunks * 3 / 2;
|
||||
buf->b_ml.ml_chunksize = (chunksize_T *)
|
||||
vim_realloc(buf->b_ml.ml_chunksize,
|
||||
@@ -5064,6 +5066,7 @@ ml_updatechunk(buf, line, len, updtype)
|
||||
if (buf->b_ml.ml_chunksize == NULL)
|
||||
{
|
||||
/* Hmmmm, Give up on offset for this buffer */
|
||||
vim_free(t_chunksize);
|
||||
buf->b_ml.ml_usedchunks = -1;
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user