From 84b8612987320f722c33dff3a3f16930407c62ce Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 23 Jul 2018 00:23:18 -0400 Subject: vim-patch:8.0.1512: warning for possibly using NULL pointer Problem: Warning for possibly using NULL pointer. (Coverity) Solution: Skip using the pointer if it's NULL. https://github.com/vim/vim/commit/e4db7aedab65abadcc84c78e7a10ec7bb62f11cf --- src/nvim/memline.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/nvim/memline.c') diff --git a/src/nvim/memline.c b/src/nvim/memline.c index fc9a1e8271..84ceaf0973 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -1365,11 +1365,11 @@ recover_names ( */ if (curbuf->b_ml.ml_mfp != NULL && (p = curbuf->b_ml.ml_mfp->mf_fname) != NULL) { - for (int i = 0; i < num_files; ++i) - if (path_full_compare(p, files[i], TRUE) & kEqualFiles) { - /* Remove the name from files[i]. Move further entries - * down. When the array becomes empty free it here, since - * FreeWild() won't be called below. */ + for (int i = 0; i < num_files; i++) { + if (path_full_compare(p, files[i], true) & kEqualFiles) { + // Remove the name from files[i]. Move further entries + // down. When the array becomes empty free it here, since + // FreeWild() won't be called below. xfree(files[i]); if (--num_files == 0) xfree(files); @@ -1377,6 +1377,7 @@ recover_names ( for (; i < num_files; ++i) files[i] = files[i + 1]; } + } } if (nr > 0) { file_count += num_files; -- cgit