]> granicus.if.org Git - vim/commitdiff
patch 8.0.0648: possible use of NULL pointer v8.0.0648
authorBram Moolenaar <Bram@vim.org>
Mon, 19 Jun 2017 18:35:32 +0000 (20:35 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 19 Jun 2017 18:35:32 +0000 (20:35 +0200)
Problem:    Possible use of NULL pointer if buflist_new() returns NULL.
            (Coverity)
Solution:   Check for NULL pointer in set_bufref().

src/buffer.c
src/version.c

index 2f574e03d7b2b9887dc3f2adfb62a1fb26412563..e8e1a6de0adab39594dcc48e45991857605b56db 100644 (file)
@@ -372,7 +372,7 @@ open_buffer(
 set_bufref(bufref_T *bufref, buf_T *buf)
 {
     bufref->br_buf = buf;
-    bufref->br_fnum = buf->b_fnum;
+    bufref->br_fnum = buf == NULL ? 0 : buf->b_fnum;
     bufref->br_buf_free_count = buf_free_count;
 }
 
index 59f0d097731ec720db6d2a5fe22297792aa6f331..b221ce25981639b3f107a13f88f366a58d5bcdd6 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    648,
 /**/
     647,
 /**/