mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 9.0.0820: memory leak with empty shell command
Problem: Memory leak with empty shell command. Solution: Free the empty string.
This commit is contained in:
@@ -957,12 +957,15 @@ do_bang(
|
|||||||
}
|
}
|
||||||
} while (trailarg != NULL);
|
} while (trailarg != NULL);
|
||||||
|
|
||||||
// Don't clear "prevcmd" if there is no command to run.
|
// Only set "prevcmd" if there is a command to run, otherwise keep te one
|
||||||
|
// we have.
|
||||||
if (STRLEN(newcmd) > 0)
|
if (STRLEN(newcmd) > 0)
|
||||||
{
|
{
|
||||||
vim_free(prevcmd);
|
vim_free(prevcmd);
|
||||||
prevcmd = newcmd;
|
prevcmd = newcmd;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
free_newcmd = TRUE;
|
||||||
|
|
||||||
if (bangredo) // put cmd in redo buffer for ! command
|
if (bangredo) // put cmd in redo buffer for ! command
|
||||||
{
|
{
|
||||||
@@ -986,6 +989,8 @@ do_bang(
|
|||||||
*/
|
*/
|
||||||
if (*p_shq != NUL)
|
if (*p_shq != NUL)
|
||||||
{
|
{
|
||||||
|
if (free_newcmd)
|
||||||
|
vim_free(newcmd);
|
||||||
newcmd = alloc(STRLEN(prevcmd) + 2 * STRLEN(p_shq) + 1);
|
newcmd = alloc(STRLEN(prevcmd) + 2 * STRLEN(p_shq) + 1);
|
||||||
if (newcmd == NULL)
|
if (newcmd == NULL)
|
||||||
return;
|
return;
|
||||||
|
@@ -695,6 +695,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
820,
|
||||||
/**/
|
/**/
|
||||||
819,
|
819,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user