Fixed memory leak in marshal.
This commit is contained in:
parent
e09bcc874a
commit
000daaee57
|
@ -1522,8 +1522,10 @@ PyMarshal_WriteObjectToString(PyObject *x, int version)
|
||||||
wf.depth = 0;
|
wf.depth = 0;
|
||||||
wf.version = version;
|
wf.version = version;
|
||||||
if (version >= 3) {
|
if (version >= 3) {
|
||||||
if ((wf.refs = PyDict_New()) == NULL)
|
if ((wf.refs = PyDict_New()) == NULL) {
|
||||||
|
Py_DECREF(wf.str);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
wf.refs = NULL;
|
wf.refs = NULL;
|
||||||
w_object(x, &wf);
|
w_object(x, &wf);
|
||||||
|
|
Loading…
Reference in New Issue