1
0
forked from aniani/vim

patch 8.2.0573: using :version twice leaks memory

Problem:    using :version twice leaks memory
Solution:   Only initialize variables once. (Dominique Pelle, closes #5917)
This commit is contained in:
Bram Moolenaar
2020-04-13 18:25:33 +02:00
parent df1956075d
commit 278e83863b
5 changed files with 30 additions and 13 deletions

View File

@@ -54,19 +54,22 @@ init_longVersion(void)
void
init_longVersion(void)
{
char *date_time = __DATE__ " " __TIME__;
char *msg = _("%s (%s, compiled %s)");
size_t len = strlen(msg)
+ strlen(VIM_VERSION_LONG_ONLY)
+ strlen(VIM_VERSION_DATE_ONLY)
+ strlen(date_time);
longVersion = alloc(len);
if (longVersion == NULL)
longVersion = VIM_VERSION_LONG;
else
vim_snprintf(longVersion, len, msg,
VIM_VERSION_LONG_ONLY, VIM_VERSION_DATE_ONLY, date_time);
{
char *date_time = __DATE__ " " __TIME__;
char *msg = _("%s (%s, compiled %s)");
size_t len = strlen(msg)
+ strlen(VIM_VERSION_LONG_ONLY)
+ strlen(VIM_VERSION_DATE_ONLY)
+ strlen(date_time);
longVersion = alloc(len);
if (longVersion == NULL)
longVersion = VIM_VERSION_LONG;
else
vim_snprintf(longVersion, len, msg,
VIM_VERSION_LONG_ONLY, VIM_VERSION_DATE_ONLY, date_time);
}
}
# endif
#else
@@ -738,6 +741,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
573,
/**/
572,
/**/