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:
@@ -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,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user