Patch 8.1.1897
Problem: May free memory twice when out of memory.
Solution: Check that backslash_halve_save() returns a different pointer.
(Dominique Pelle, closes #4847)
Files: src/cmdexpand.c, src/misc1.c
*** ../vim-8.1.1896/src/cmdexpand.c 2019-08-18 22:25:54.653448052 +0200
--- src/cmdexpand.c 2019-08-21 12:52:56.254778240 +0200
***************
*** 646,662 ****
{
char_u *halved_slash;
char_u *exp_path;
// Expansion was done before and special characters
// were escaped, need to halve backslashes. Also
// $HOME has been replaced with ~/.
exp_path = expand_env_save_opt(files_found[k], TRUE);
! halved_slash = backslash_halve_save(
! exp_path != NULL ? exp_path : files_found[k]);
j = mch_isdir(halved_slash != NULL ? halved_slash
: files_found[k]);
vim_free(exp_path);
! vim_free(halved_slash);
}
else
// Expansion was done here, file names are literal.
--- 646,664 ----
{
char_u *halved_slash;
char_u *exp_path;
+ char_u *path;
// Expansion was done before and special characters
// were escaped, need to halve backslashes. Also
// $HOME has been replaced with ~/.
exp_path = expand_env_save_opt(files_found[k], TRUE);
! path = exp_path != NULL ? exp_path : files_found[k];
! halved_slash = backslash_halve_save(path);
j = mch_isdir(halved_slash != NULL ? halved_slash
: files_found[k]);
vim_free(exp_path);
! if (halved_slash != path)
! vim_free(halved_slash);
}
else
// Expansion was done here, file names are literal.
*** ../vim-8.1.1896/src/misc1.c 2019-08-20 20:13:40.326821952 +0200
--- src/misc1.c 2019-08-21 12:52:56.254778240 +0200
***************
*** 4086,4092 ****
addfile(&ga, t, flags | EW_DIR | EW_FILE);
else
addfile(&ga, t, flags);
! vim_free(t);
}
#if defined(FEAT_SEARCHPATH)
--- 4086,4094 ----
addfile(&ga, t, flags | EW_DIR | EW_FILE);
else
addfile(&ga, t, flags);
!
! if (t != p)
! vim_free(t);
}
#if defined(FEAT_SEARCHPATH)
*** ../vim-8.1.1896/src/version.c 2019-08-20 23:14:11.836090662 +0200
--- src/version.c 2019-08-21 12:50:58.823317797 +0200
***************
*** 767,768 ****
--- 767,770 ----
{ /* Add new patch number below this line */
+ /**/
+ 1897,
/**/
--
>From "know your smileys":
:-& Eating spaghetti
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/201908211055.x7LAt8lt003823%40masaka.moolenaar.net.