aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/memline.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <janedmundlazo@hotmail.com>2018-07-23 00:23:18 -0400
committerJan Edmund Lazo <janedmundlazo@hotmail.com>2018-07-23 08:34:25 -0400
commit84b8612987320f722c33dff3a3f16930407c62ce (patch)
tree9c930548001b4db351b6a8a423bb4e59a095a1f5 /src/nvim/memline.c
parent9fbbec76aaa8d45ba54bb136b750f2ccc440207f (diff)
downloadrneovim-84b8612987320f722c33dff3a3f16930407c62ce.tar.gz
rneovim-84b8612987320f722c33dff3a3f16930407c62ce.tar.bz2
rneovim-84b8612987320f722c33dff3a3f16930407c62ce.zip
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
Diffstat (limited to 'src/nvim/memline.c')
-rw-r--r--src/nvim/memline.c11
1 files changed, 6 insertions, 5 deletions
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;