mirror of
https://github.com/neovim/neovim.git
synced 2025-10-17 07:16:09 +00:00
vim-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.
3d6014f033
This commit is contained in:
@@ -4217,7 +4217,9 @@ void shorten_buf_fname(buf_T *buf, char_u *dirname, int force)
|
||||
&& (force
|
||||
|| buf->b_sfname == NULL
|
||||
|| path_is_absolute(buf->b_sfname))) {
|
||||
XFREE_CLEAR(buf->b_sfname);
|
||||
if (buf->b_sfname != buf->b_ffname) {
|
||||
XFREE_CLEAR(buf->b_sfname);
|
||||
}
|
||||
p = path_shorten_fname(buf->b_ffname, dirname);
|
||||
if (p != NULL) {
|
||||
buf->b_sfname = vim_strsave(p);
|
||||
|
Reference in New Issue
Block a user