From 83a32aad82f87fda3d8a5984ebf627213c18177a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eliseo=20Marti=CC=81nez?= Date: Wed, 12 Nov 2014 10:39:44 +0100 Subject: [PATCH] Fix warnings: quickfix.c: qf_add_entry(): Np dereference: FP. Problem : Dereference of null pointer @ 921. Diagnostic : False positive. Rationale : If `qi->qf_lists[qi->qf_curlist].qf_count == 0` doesn't hold, we should be calling function with nonnull `*prevp`. Resolution : Assert nonnull. --- src/nvim/quickfix.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 5ffd5ea263..3de7f73339 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -10,6 +10,7 @@ * quickfix.c: functions for quickfix mode, using a file with error messages */ +#include #include #include #include @@ -880,7 +881,7 @@ void qf_free_all(win_T *wp) static int qf_add_entry ( qf_info_T *qi, /* quickfix list */ - qfline_T **prevp, /* pointer to previously added entry or NULL */ + qfline_T **prevp, /* nonnull pointer (to previously added entry or NULL) */ char_u *dir, /* optional directory name */ char_u *fname, /* file name or NULL */ int bufnum, /* buffer number or zero */ @@ -920,6 +921,7 @@ qf_add_entry ( qi->qf_lists[qi->qf_curlist].qf_start = qfp; qfp->qf_prev = qfp; /* first element points to itself */ } else { + assert(*prevp); qfp->qf_prev = *prevp; (*prevp)->qf_next = qfp; }