0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.1.0470: pointer ownership around fname_expand() is unclear

Problem:    Pointer ownership around fname_expand() is unclear.
Solution:   Allow b_ffname and b_sfname to point to the same allocated memory,
            only free one.  Update comments.
This commit is contained in:
Bram Moolenaar
2018-10-11 19:27:47 +02:00
parent 108e7b422b
commit 3d6014f033
5 changed files with 55 additions and 28 deletions

View File

@@ -6187,7 +6187,8 @@ shorten_buf_fname(buf_T *buf, char_u *dirname, int force)
|| buf->b_sfname == NULL
|| mch_isFullName(buf->b_sfname)))
{
VIM_CLEAR(buf->b_sfname);
if (buf->b_sfname != buf->b_ffname)
VIM_CLEAR(buf->b_sfname);
p = shorten_fname(buf->b_ffname, dirname);
if (p != NULL)
{