Mercurial > vim
comparison src/ex_cmds.c @ 14917:6f2ce3b311de v8.1.0470
patch 8.1.0470: pointer ownership around fname_expand() is unclear
commit https://github.com/vim/vim/commit/3d6014f0336d9a64c01a7518fe45fde0a925fa20
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Oct 11 19:27:47 2018 +0200
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 11 Oct 2018 19:30:05 +0200 |
parents | d4777be849d0 |
children | e3910b9827d0 |
comparison
equal
deleted
inserted
replaced
14916:11372e362ffc | 14917:6f2ce3b311de |
---|---|
3646 | 3646 |
3647 return FALSE; | 3647 return FALSE; |
3648 } | 3648 } |
3649 | 3649 |
3650 /* | 3650 /* |
3651 * Try to abandon current file and edit a new or existing file. | 3651 * Try to abandon the current file and edit a new or existing file. |
3652 * "fnum" is the number of the file, if zero use ffname/sfname. | 3652 * "fnum" is the number of the file, if zero use "ffname_arg"/"sfname_arg". |
3653 * "lnum" is the line number for the cursor in the new file (if non-zero). | 3653 * "lnum" is the line number for the cursor in the new file (if non-zero). |
3654 * | 3654 * |
3655 * Return: | 3655 * Return: |
3656 * GETFILE_ERROR for "normal" error, | 3656 * GETFILE_ERROR for "normal" error, |
3657 * GETFILE_NOT_WRITTEN for "not written" error, | 3657 * GETFILE_NOT_WRITTEN for "not written" error, |
3659 * GETFILE_OPEN_OTHER for successfully opening another file. | 3659 * GETFILE_OPEN_OTHER for successfully opening another file. |
3660 */ | 3660 */ |
3661 int | 3661 int |
3662 getfile( | 3662 getfile( |
3663 int fnum, | 3663 int fnum, |
3664 char_u *ffname, | 3664 char_u *ffname_arg, |
3665 char_u *sfname, | 3665 char_u *sfname_arg, |
3666 int setpm, | 3666 int setpm, |
3667 linenr_T lnum, | 3667 linenr_T lnum, |
3668 int forceit) | 3668 int forceit) |
3669 { | 3669 { |
3670 char_u *ffname = ffname_arg; | |
3671 char_u *sfname = sfname_arg; | |
3670 int other; | 3672 int other; |
3671 int retval; | 3673 int retval; |
3672 char_u *free_me = NULL; | 3674 char_u *free_me = NULL; |
3673 | 3675 |
3674 if (text_locked()) | 3676 if (text_locked()) |