File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -542,6 +542,7 @@ Soren Larsen
542
542
Piers Lauder
543
543
Ben Laurie
544
544
Simon Law
545
+ Julia Lawall
545
546
Chris Lawrence
546
547
Brian Leair
547
548
James Lee
Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ What's New in Python 3.2.4
10
10
Core and Builtins
11
11
-----------------
12
12
13
+ - Issue #15394: An issue in PyModule_Create that caused references to
14
+ be leaked on some error paths has been fixed. Patch by Julia Lawall.
15
+
13
16
- Issue #15368: An issue that caused bytecode generation to be
14
17
non-deterministic when using randomized hashing (-R) has been fixed.
15
18
Original file line number Diff line number Diff line change @@ -117,25 +117,30 @@ PyModule_Create2(struct PyModuleDef* module, int module_api_version)
117
117
d = PyModule_GetDict ((PyObject * )m );
118
118
if (module -> m_methods != NULL ) {
119
119
n = PyUnicode_FromString (name );
120
- if (n == NULL )
120
+ if (n == NULL ) {
121
+ Py_DECREF (m );
121
122
return NULL ;
123
+ }
122
124
for (ml = module -> m_methods ; ml -> ml_name != NULL ; ml ++ ) {
123
125
if ((ml -> ml_flags & METH_CLASS ) ||
124
126
(ml -> ml_flags & METH_STATIC )) {
125
127
PyErr_SetString (PyExc_ValueError ,
126
128
"module functions cannot set"
127
129
" METH_CLASS or METH_STATIC" );
128
130
Py_DECREF (n );
131
+ Py_DECREF (m );
129
132
return NULL ;
130
133
}
131
134
v = PyCFunction_NewEx (ml , (PyObject * )m , n );
132
135
if (v == NULL ) {
133
136
Py_DECREF (n );
137
+ Py_DECREF (m );
134
138
return NULL ;
135
139
}
136
140
if (PyDict_SetItemString (d , ml -> ml_name , v ) != 0 ) {
137
141
Py_DECREF (v );
138
142
Py_DECREF (n );
143
+ Py_DECREF (m );
139
144
return NULL ;
140
145
}
141
146
Py_DECREF (v );
@@ -146,6 +151,7 @@ PyModule_Create2(struct PyModuleDef* module, int module_api_version)
146
151
v = PyUnicode_FromString (module -> m_doc );
147
152
if (v == NULL || PyDict_SetItemString (d , "__doc__" , v ) != 0 ) {
148
153
Py_XDECREF (v );
154
+ Py_DECREF (m );
149
155
return NULL ;
150
156
}
151
157
Py_DECREF (v );
You can’t perform that action at this time.
0 commit comments