summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1021
blob: b4cc9188d88a940d067f577f9b42d582ade3749c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1021
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.1021
Problem:    pyeval() and py3eval() leak memory.
Solution:   Do not increase the reference count twice. (Ozaki Kiichi,
            closes #4129)
Files:	    src/if_python.c, src/if_python3.c


*** ../vim-8.1.1020/src/if_python.c	2019-02-18 22:04:52.949609091 +0100
--- src/if_python.c	2019-03-19 22:21:25.028534491 +0100
***************
*** 1555,1584 ****
  }
  
      void
! do_pyeval (char_u *str, typval_T *rettv)
  {
      DoPyCommand((char *) str,
  	    (rangeinitializer) init_range_eval,
  	    (runner) run_eval,
  	    (void *) rettv);
!     switch (rettv->v_type)
      {
! 	case VAR_DICT: ++rettv->vval.v_dict->dv_refcount; break;
! 	case VAR_LIST: ++rettv->vval.v_list->lv_refcount; break;
! 	case VAR_FUNC: func_ref(rettv->vval.v_string);    break;
! 	case VAR_PARTIAL: ++rettv->vval.v_partial->pt_refcount; break;
! 	case VAR_UNKNOWN:
! 	    rettv->v_type = VAR_NUMBER;
! 	    rettv->vval.v_number = 0;
! 	    break;
! 	case VAR_NUMBER:
! 	case VAR_STRING:
! 	case VAR_FLOAT:
! 	case VAR_SPECIAL:
! 	case VAR_JOB:
! 	case VAR_CHANNEL:
! 	case VAR_BLOB:
! 	    break;
      }
  }
  
--- 1555,1570 ----
  }
  
      void
! do_pyeval(char_u *str, typval_T *rettv)
  {
      DoPyCommand((char *) str,
  	    (rangeinitializer) init_range_eval,
  	    (runner) run_eval,
  	    (void *) rettv);
!     if (rettv->v_type == VAR_UNKNOWN)
      {
! 	rettv->v_type = VAR_NUMBER;
! 	rettv->vval.v_number = 0;
      }
  }
  
***************
*** 1594,1600 ****
  #endif /* Python 1.4 */
  
      int
! set_ref_in_python (int copyID)
  {
      return set_ref_in_py(copyID);
  }
--- 1580,1586 ----
  #endif /* Python 1.4 */
  
      int
! set_ref_in_python(int copyID)
  {
      return set_ref_in_py(copyID);
  }
*** ../vim-8.1.1020/src/if_python3.c	2019-03-19 22:11:37.933528483 +0100
--- src/if_python3.c	2019-03-19 22:21:25.028534491 +0100
***************
*** 1663,1697 ****
  }
  
      void
! do_py3eval (char_u *str, typval_T *rettv)
  {
      DoPyCommand((char *) str,
  	    (rangeinitializer) init_range_eval,
  	    (runner) run_eval,
  	    (void *) rettv);
!     switch(rettv->v_type)
      {
! 	case VAR_DICT: ++rettv->vval.v_dict->dv_refcount; break;
! 	case VAR_LIST: ++rettv->vval.v_list->lv_refcount; break;
! 	case VAR_FUNC: func_ref(rettv->vval.v_string);    break;
! 	case VAR_PARTIAL: ++rettv->vval.v_partial->pt_refcount; break;
! 	case VAR_UNKNOWN:
! 	    rettv->v_type = VAR_NUMBER;
! 	    rettv->vval.v_number = 0;
! 	    break;
! 	case VAR_NUMBER:
! 	case VAR_STRING:
! 	case VAR_FLOAT:
! 	case VAR_SPECIAL:
! 	case VAR_JOB:
! 	case VAR_CHANNEL:
! 	case VAR_BLOB:
! 	    break;
      }
  }
  
      int
! set_ref_in_python3 (int copyID)
  {
      return set_ref_in_py(copyID);
  }
--- 1663,1683 ----
  }
  
      void
! do_py3eval(char_u *str, typval_T *rettv)
  {
      DoPyCommand((char *) str,
  	    (rangeinitializer) init_range_eval,
  	    (runner) run_eval,
  	    (void *) rettv);
!     if (rettv->v_type == VAR_UNKNOWN)
      {
! 	rettv->v_type = VAR_NUMBER;
! 	rettv->vval.v_number = 0;
      }
  }
  
      int
! set_ref_in_python3(int copyID)
  {
      return set_ref_in_py(copyID);
  }
*** ../vim-8.1.1020/src/version.c	2019-03-19 22:11:37.933528483 +0100
--- src/version.c	2019-03-19 22:21:12.036641890 +0100
***************
*** 781,782 ****
--- 781,784 ----
  {   /* Add new patch number below this line */
+ /**/
+     1021,
  /**/

-- 
In order for something to become clean, something else must become dirty;
but you can get everything dirty without getting anything clean.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///