helptags: fix double-free (#7600)

closes #7599
Helped-by: oni-link <knil.ino@gmail.com>

Freeing `dirname` was first introduced by a code refactoring from `ex_helptags()` to `do_helptags()` (`vim-patch:7.4.1551`)(#4648) and later removed by `vim-patch:7.4.1562`(#4660).
Only problem with that is, that the patches were not applied in order so the fixing patch was declared `N/A`.

So `do_helptags()` should have never freed `dirname`.
This commit is contained in:
Hannu Hartikainen 2017-11-20 22:20:01 +02:00 committed by Justin M. Keyes
parent 7d24a95b45
commit c391401648

View File

@ -5292,7 +5292,6 @@ static void do_helptags(char_u *dirname, bool add_help_tags)
if (!add_pathsep((char *)NameBuff) if (!add_pathsep((char *)NameBuff)
|| STRLCAT(NameBuff, "**", sizeof(NameBuff)) >= MAXPATHL) { || STRLCAT(NameBuff, "**", sizeof(NameBuff)) >= MAXPATHL) {
EMSG(_(e_fnametoolong)); EMSG(_(e_fnametoolong));
xfree(dirname);
return; return;
} }
@ -5303,7 +5302,6 @@ static void do_helptags(char_u *dirname, bool add_help_tags)
EW_FILE|EW_SILENT) == FAIL EW_FILE|EW_SILENT) == FAIL
|| filecount == 0) { || filecount == 0) {
EMSG2(_("E151: No match: %s"), NameBuff); EMSG2(_("E151: No match: %s"), NameBuff);
xfree(dirname);
return; return;
} }