sip4: fix memleak with Python 3.11
This commit is contained in:
parent
c9b446f7c5
commit
e97b043c1b
1 changed files with 4 additions and 1 deletions
|
@ -20,7 +20,7 @@
|
||||||
static int sip_api_check_plugin_for_type(const sipTypeDef *td,
|
static int sip_api_check_plugin_for_type(const sipTypeDef *td,
|
||||||
const char *name);
|
const char *name);
|
||||||
static PyObject *sip_api_unicode_new(SIP_SSIZE_T len, unsigned maxchar,
|
static PyObject *sip_api_unicode_new(SIP_SSIZE_T len, unsigned maxchar,
|
||||||
@@ -13741,13 +13741,13 @@ static int sip_api_is_user_type(const si
|
@@ -13741,13 +13741,16 @@ static int sip_api_is_user_type(const si
|
||||||
/*
|
/*
|
||||||
* Return a frame from the execution stack.
|
* Return a frame from the execution stack.
|
||||||
*/
|
*/
|
||||||
|
@ -29,11 +29,14 @@
|
||||||
{
|
{
|
||||||
- struct _frame *frame = PyEval_GetFrame();
|
- struct _frame *frame = PyEval_GetFrame();
|
||||||
+ PyFrameObject *frame = PyEval_GetFrame();
|
+ PyFrameObject *frame = PyEval_GetFrame();
|
||||||
|
+ Py_XINCREF(frame);
|
||||||
|
|
||||||
while (frame != NULL && depth > 0)
|
while (frame != NULL && depth > 0)
|
||||||
{
|
{
|
||||||
- frame = frame->f_back;
|
- frame = frame->f_back;
|
||||||
|
+ PyFrameObject *oframe = frame;
|
||||||
+ frame = PyFrame_GetBack(frame);
|
+ frame = PyFrame_GetBack(frame);
|
||||||
|
+ Py_DECREF(oframe);
|
||||||
--depth;
|
--depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue