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