Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit aaef05f

Browse files
Fixed memory leak in marshal.
2 parents 66acbb2 + 000daae commit aaef05f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Python/marshal.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1520,8 +1520,10 @@ PyMarshal_WriteObjectToString(PyObject *x, int version)
15201520
wf.depth = 0;
15211521
wf.version = version;
15221522
if (version >= 3) {
1523-
if ((wf.refs = PyDict_New()) == NULL)
1523+
if ((wf.refs = PyDict_New()) == NULL) {
1524+
Py_DECREF(wf.str);
15241525
return NULL;
1526+
}
15251527
} else
15261528
wf.refs = NULL;
15271529
w_object(x, &wf);

0 commit comments

Comments
 (0)