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

Skip to content

Commit 6f0b80c

Browse files
authored
Merge pull request #13345 from meeseeksmachine/auto-backport-of-pr-13333-on-v3.0.x
Backport PR #13333 on branch v3.0.x (Fix possible leak of return of PySequence_GetItem.)
2 parents 5fa2e77 + ec0f1fa commit 6f0b80c

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
@@ -727,6 +727,7 @@ static PyObject *Py_convert_to_string(PyObject *self, PyObject *args, PyObject *
727727
return NULL;
728728
}
729729
codes[i] = PyBytes_AsString(item);
730+
Py_DECREF(item);
730731
if (codes[i] == NULL) {
731732
return NULL;
732733
}

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)