118 lines
3.8 KiB
Plaintext
118 lines
3.8 KiB
Plaintext
|
To: vim-dev@vim.org
|
||
|
Subject: Patch 7.2.238
|
||
|
Fcc: outbox
|
||
|
From: Bram Moolenaar <Bram@moolenaar.net>
|
||
|
Mime-Version: 1.0
|
||
|
Content-Type: text/plain; charset=UTF-8
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
------------
|
||
|
|
||
|
Patch 7.2.238
|
||
|
Problem: Leaking memory when setting term to "builtin_dumb".
|
||
|
Solution: Free memory when resetting term option t_Co.
|
||
|
Files: src/option.c, src/proto/option.pro, src/term.c
|
||
|
|
||
|
|
||
|
*** ../vim-7.2.237/src/option.c 2009-06-16 17:50:56.000000000 +0200
|
||
|
--- src/option.c 2009-07-22 12:49:19.000000000 +0200
|
||
|
***************
|
||
|
*** 403,410 ****
|
||
|
#define P_NUM 0x02 /* the option is numeric */
|
||
|
#define P_STRING 0x04 /* the option is a string */
|
||
|
#define P_ALLOCED 0x08 /* the string option is in allocated memory,
|
||
|
! must use vim_free() when assigning new
|
||
|
! value. Not set if default is the same. */
|
||
|
#define P_EXPAND 0x10 /* environment expansion. NOTE: P_EXPAND can
|
||
|
never be used for local or hidden options! */
|
||
|
#define P_NODEFAULT 0x40 /* don't set to default value */
|
||
|
--- 403,411 ----
|
||
|
#define P_NUM 0x02 /* the option is numeric */
|
||
|
#define P_STRING 0x04 /* the option is a string */
|
||
|
#define P_ALLOCED 0x08 /* the string option is in allocated memory,
|
||
|
! must use free_string_option() when
|
||
|
! assigning new value. Not set if default is
|
||
|
! the same. */
|
||
|
#define P_EXPAND 0x10 /* environment expansion. NOTE: P_EXPAND can
|
||
|
never be used for local or hidden options! */
|
||
|
#define P_NODEFAULT 0x40 /* don't set to default value */
|
||
|
***************
|
||
|
*** 8927,8932 ****
|
||
|
--- 8928,8955 ----
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
+ * Free the string for one term option, if it was allocated.
|
||
|
+ * Set the string to empty_option and clear allocated flag.
|
||
|
+ * "var" points to the option value.
|
||
|
+ */
|
||
|
+ void
|
||
|
+ free_one_termoption(var)
|
||
|
+ char_u *var;
|
||
|
+ {
|
||
|
+ struct vimoption *p;
|
||
|
+
|
||
|
+ for (p = &options[0]; p->fullname != NULL; p++)
|
||
|
+ if (p->var == var)
|
||
|
+ {
|
||
|
+ if (p->flags & P_ALLOCED)
|
||
|
+ free_string_option(*(char_u **)(p->var));
|
||
|
+ *(char_u **)(p->var) = empty_option;
|
||
|
+ p->flags &= ~P_ALLOCED;
|
||
|
+ break;
|
||
|
+ }
|
||
|
+ }
|
||
|
+
|
||
|
+ /*
|
||
|
* Set the terminal option defaults to the current value.
|
||
|
* Used after setting the terminal name.
|
||
|
*/
|
||
|
*** ../vim-7.2.237/src/proto/option.pro 2009-02-21 20:27:00.000000000 +0100
|
||
|
--- src/proto/option.pro 2009-07-22 12:52:31.000000000 +0200
|
||
|
***************
|
||
|
*** 29,34 ****
|
||
|
--- 29,35 ----
|
||
|
int makefoldset __ARGS((FILE *fd));
|
||
|
void clear_termoptions __ARGS((void));
|
||
|
void free_termoptions __ARGS((void));
|
||
|
+ void free_one_termoption __ARGS((char_u *var));
|
||
|
void set_term_defaults __ARGS((void));
|
||
|
void comp_col __ARGS((void));
|
||
|
char_u *get_equalprg __ARGS((void));
|
||
|
*** ../vim-7.2.237/src/term.c 2009-06-16 14:31:56.000000000 +0200
|
||
|
--- src/term.c 2009-07-22 13:19:59.000000000 +0200
|
||
|
***************
|
||
|
*** 2881,2887 ****
|
||
|
|
||
|
/* if 'Sb' and 'AB' are not defined, reset "Co" */
|
||
|
if (*T_CSB == NUL && *T_CAB == NUL)
|
||
|
! T_CCO = empty_option;
|
||
|
|
||
|
/* Set 'weirdinvert' according to value of 't_xs' */
|
||
|
p_wiv = (*T_XS != NUL);
|
||
|
--- 2881,2887 ----
|
||
|
|
||
|
/* if 'Sb' and 'AB' are not defined, reset "Co" */
|
||
|
if (*T_CSB == NUL && *T_CAB == NUL)
|
||
|
! free_one_termoption(T_CCO);
|
||
|
|
||
|
/* Set 'weirdinvert' according to value of 't_xs' */
|
||
|
p_wiv = (*T_XS != NUL);
|
||
|
*** ../vim-7.2.237/src/version.c 2009-07-22 13:27:50.000000000 +0200
|
||
|
--- src/version.c 2009-07-22 14:25:44.000000000 +0200
|
||
|
***************
|
||
|
*** 678,679 ****
|
||
|
--- 678,681 ----
|
||
|
{ /* Add new patch number below this line */
|
||
|
+ /**/
|
||
|
+ 238,
|
||
|
/**/
|
||
|
|
||
|
--
|
||
|
hundred-and-one symptoms of being an internet addict:
|
||
|
95. Only communication in your household is through email.
|
||
|
|
||
|
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
||
|
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
||
|
\\\ download, build and distribute -- http://www.A-A-P.org ///
|
||
|
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|