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

Skip to content

Commit 8d62769

Browse files
authored
Merge pull request #13333 from QuLogic/PySequence_GetItem-leak
Fix possible leak of return of PySequence_GetItem.
2 parents 78736fa + f0c5969 commit 8d62769

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/_path_wrapper.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,7 @@ static PyObject *Py_convert_to_string(PyObject *self, PyObject *args, PyObject *
725725
return NULL;
726726
}
727727
codes[i] = PyBytes_AsString(item);
728+
Py_DECREF(item);
728729
if (codes[i] == NULL) {
729730
return NULL;
730731
}

src/py_adaptors.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ class PathGenerator
240240
throw py::exception();
241241
}
242242
if (!convert_path(item, &path)) {
243+
Py_DECREF(item);
243244
throw py::exception();
244245
}
245246
Py_DECREF(item);

0 commit comments

Comments
 (0)