Merge pull request #27221 from BugLight/fix-coverity-found-bugs

Fix bugs found by coverity
This commit is contained in:
zeertzjq 2024-01-28 13:33:38 +08:00 committed by GitHub
commit 74e695d227
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -366,6 +366,7 @@ static int put_view(FILE *fd, win_T *wp, int add_edit, unsigned *flagp, int curr
if (put_line(fd, "enew | setl bt=help") == FAIL
|| fprintf(fd, "help %s", curtag) < 0 || put_eol(fd) == FAIL) {
xfree(fname_esc);
return FAIL;
}
} else if (wp->w_buffer->b_ffname != NULL

View File

@ -701,6 +701,9 @@ void get_local_additions(void)
const char *const f1 = fnames[i1];
const char *const t1 = path_tail(f1);
const char *const e1 = strrchr(t1, '.');
if (e1 == NULL) {
continue;
}
if (path_fnamecmp(e1, ".txt") != 0
&& path_fnamecmp(e1, fname + 4) != 0) {
// Not .txt and not .abx, remove it.
@ -715,7 +718,7 @@ void get_local_additions(void)
}
const char *const t2 = path_tail(f2);
const char *const e2 = strrchr(t2, '.');
if (e1 == NULL || e2 == NULL) {
if (e2 == NULL) {
continue;
}
if (e1 - f1 != e2 - f2