aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEliseo Martínez <eliseomarmol@gmail.com>2014-11-12 10:39:44 +0100
committerEliseo Martínez <eliseomarmol@gmail.com>2014-11-15 12:48:28 +0100
commit83a32aad82f87fda3d8a5984ebf627213c18177a (patch)
treeb3817e3d042762f523993af0107e9fd89007a7c0 /src
parent3d57bcee7d0783f554497b7e3b1dda06df4ea40c (diff)
downloadrneovim-83a32aad82f87fda3d8a5984ebf627213c18177a.tar.gz
rneovim-83a32aad82f87fda3d8a5984ebf627213c18177a.tar.bz2
rneovim-83a32aad82f87fda3d8a5984ebf627213c18177a.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/quickfix.c4
1 files changed, 3 insertions, 1 deletions
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 <assert.h>
#include <errno.h>
#include <inttypes.h>
#include <stdbool.h>
@@ -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;
}