]> granicus.if.org Git - vim/commitdiff
patch 8.0.0988: warning from Covscan about using NULL pointer v8.0.0988
authorBram Moolenaar <Bram@vim.org>
Wed, 23 Aug 2017 20:32:35 +0000 (22:32 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 23 Aug 2017 20:32:35 +0000 (22:32 +0200)
Problem:    Warning from Covscan about using NULL pointer.
Solution:   Add extra check for NULL. (zdohnal)

src/fileio.c
src/undo.c
src/version.c

index f54fb84657ee8527b88bc29ad48dcce9c986577e..87a46b1b8fce886d884f606baf7281a47094d67e 100644 (file)
@@ -1370,7 +1370,8 @@ retry:
                 * Decrypt the read bytes.  This is done before checking for
                 * EOF because the crypt layer may be buffering.
                 */
-               if (cryptkey != NULL && size > 0)
+               if (cryptkey != NULL && curbuf->b_cryptstate != NULL
+                                                                  && size > 0)
                {
                    if (crypt_works_inplace(curbuf->b_cryptstate))
                    {
index b913841f709af2e2929ac7457c6706fabdb147f7..62963a995ef3df13415dde1a27f1b317b03bc3db 100644 (file)
@@ -921,7 +921,7 @@ undo_write(bufinfo_T *bi, char_u *ptr, size_t len)
     static int
 undo_flush(bufinfo_T *bi)
 {
-    if (bi->bi_buffer != NULL && bi->bi_used > 0)
+    if (bi->bi_buffer != NULL && bi->bi_state != NULL && bi->bi_used > 0)
     {
        crypt_encode_inplace(bi->bi_state, bi->bi_buffer, bi->bi_used);
        if (fwrite(bi->bi_buffer, bi->bi_used, (size_t)1, bi->bi_fp) != 1)
index 6d2de866330a66ef84a6b350a0bccd6a8b70f55b..83cb3d9115a9a5057d89af48312e513f13186618 100644 (file)
@@ -769,6 +769,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    988,
 /**/
     987,
 /**/