summaryrefslogtreecommitdiff
path: root/src/memline.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2015-02-10 18:34:01 +0100
committerBram Moolenaar <Bram@vim.org>2015-02-10 18:34:01 +0100
commit9abd5c6507154eabdfe8256940a24f090db0f533 (patch)
tree6c0fa11749df309d529fc35a5fd68cafd16c80a6 /src/memline.c
parenta1d2c58985584116d20fa5e132137d8ff1a535f7 (diff)
downloadvim-git-9abd5c6507154eabdfe8256940a24f090db0f533.tar.gz
updated for version 7.4.624v7.4.624
Problem: May leak memory or crash when vim_realloc() returns NULL. Solution: Handle a NULL value properly. (Mike Williams)
Diffstat (limited to 'src/memline.c')
-rw-r--r--src/memline.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/memline.c b/src/memline.c
index 7adb2dc99..d62697d6b 100644
--- a/src/memline.c
+++ b/src/memline.c
@@ -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;
}