Skip to content

Commit 829aa64

Browse files
committed
patch 8.0.0988: warning from Covscan about using NULL pointer
Problem: Warning from Covscan about using NULL pointer. Solution: Add extra check for NULL. (zdohnal)
1 parent d2c45a1 commit 829aa64

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/fileio.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1370,7 +1370,8 @@ readfile(
13701370
* Decrypt the read bytes. This is done before checking for
13711371
* EOF because the crypt layer may be buffering.
13721372
*/
1373-
if (cryptkey != NULL && size > 0)
1373+
if (cryptkey != NULL && curbuf->b_cryptstate != NULL
1374+
&& size > 0)
13741375
{
13751376
if (crypt_works_inplace(curbuf->b_cryptstate))
13761377
{

src/undo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ undo_write(bufinfo_T *bi, char_u *ptr, size_t len)
921921
static int
922922
undo_flush(bufinfo_T *bi)
923923
{
924-
if (bi->bi_buffer != NULL && bi->bi_used > 0)
924+
if (bi->bi_buffer != NULL && bi->bi_state != NULL && bi->bi_used > 0)
925925
{
926926
crypt_encode_inplace(bi->bi_state, bi->bi_buffer, bi->bi_used);
927927
if (fwrite(bi->bi_buffer, bi->bi_used, (size_t)1, bi->bi_fp) != 1)

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,8 @@ static char *(features[]) =
769769

770770
static int included_patches[] =
771771
{ /* Add new patch number below this line */
772+
/**/
773+
988,
772774
/**/
773775
987,
774776
/**/

0 commit comments

Comments
 (0)