sip4: fix memleaks with Python 3.11

This commit is contained in:
Đoàn Trần Công Danh 2022-09-25 09:44:23 +07:00
parent 18a364694f
commit f6a6bb7415

View File

@ -1,5 +1,7 @@
--- a/siplib/sip.h
+++ b/siplib/sip.h
Index: sip-4.19.25/siplib/sip.h
===================================================================
--- sip-4.19.25.orig/siplib/sip.h
+++ sip-4.19.25/siplib/sip.h
@@ -1799,7 +1799,7 @@ typedef struct _sipAPIDef {
int (*api_get_time)(PyObject *, sipTimeDef *);
PyObject *(*api_from_time)(const sipTimeDef *);
@ -9,8 +11,10 @@
int (*api_check_plugin_for_type)(const sipTypeDef *, const char *);
PyObject *(*api_unicode_new)(SIP_SSIZE_T, unsigned, int *, void **);
void (*api_unicode_write)(int, void *, int, unsigned);
--- a/siplib/siplib.c
+++ b/siplib/siplib.c
Index: sip-4.19.25/siplib/siplib.c
===================================================================
--- sip-4.19.25.orig/siplib/siplib.c
+++ sip-4.19.25/siplib/siplib.c
@@ -448,7 +448,7 @@ static PyObject *sip_api_from_datetime(c
static int sip_api_get_time(PyObject *obj, sipTimeDef *time);
static PyObject *sip_api_from_time(const sipTimeDef *time);
@ -20,7 +24,7 @@
static int sip_api_check_plugin_for_type(const sipTypeDef *td,
const char *name);
static PyObject *sip_api_unicode_new(SIP_SSIZE_T len, unsigned maxchar,
@@ -13741,13 +13741,16 @@ static int sip_api_is_user_type(const si
@@ -13741,15 +13741,19 @@ static int sip_api_is_user_type(const si
/*
* Return a frame from the execution stack.
*/
@ -39,4 +43,7 @@
+ Py_DECREF(oframe);
--depth;
}
+ Py_XDECREF(frame);
return frame;
}