mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.3403: memory leak for :retab with invalid argument
Problem: Memory leak for :retab with invalid argument. Solution: Free the memory. Make error messages consistent.
This commit is contained in:
parent
b7081e135a
commit
2ddb89f8a9
13
src/indent.c
13
src/indent.c
@ -70,9 +70,12 @@ tabstop_set(char_u *var, int **array)
|
|||||||
{
|
{
|
||||||
int n = atoi((char *)cp);
|
int n = atoi((char *)cp);
|
||||||
|
|
||||||
|
// Catch negative values, overflow and ridiculous big values.
|
||||||
if (n < 0 || n > 9999)
|
if (n < 0 || n > 9999)
|
||||||
{
|
{
|
||||||
semsg(_(e_invarg2), cp);
|
semsg(_(e_invarg2), cp);
|
||||||
|
vim_free(*array);
|
||||||
|
*array = NULL;
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
(*array)[t++] = n;
|
(*array)[t++] = n;
|
||||||
@ -1615,12 +1618,18 @@ ex_retab(exarg_T *eap)
|
|||||||
else
|
else
|
||||||
new_ts_str = vim_strnsave(new_ts_str, eap->arg - new_ts_str);
|
new_ts_str = vim_strnsave(new_ts_str, eap->arg - new_ts_str);
|
||||||
#else
|
#else
|
||||||
new_ts = getdigits(&(eap->arg));
|
ptr = eap->arg;
|
||||||
if (new_ts < 0)
|
new_ts = getdigits(&ptr);
|
||||||
|
if (new_ts < 0 && *eap->arg == '-')
|
||||||
{
|
{
|
||||||
emsg(_(e_positive));
|
emsg(_(e_positive));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (new_ts < 0 || new_ts > 9999)
|
||||||
|
{
|
||||||
|
semsg(_(e_invarg2), eap->arg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (new_ts == 0)
|
if (new_ts == 0)
|
||||||
new_ts = curbuf->b_p_ts;
|
new_ts = curbuf->b_p_ts;
|
||||||
#endif
|
#endif
|
||||||
|
@ -755,6 +755,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 */
|
||||||
|
/**/
|
||||||
|
3403,
|
||||||
/**/
|
/**/
|
||||||
3402,
|
3402,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user