Skip to content

Commit f9a8161

Browse files
committedJan 28, 2018
Fix some leaks and errors in sip conversions
1 parent ebb725e commit f9a8161

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed
 

‎python/core/conversions.sip

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1799,6 +1799,8 @@ template<int, TYPE2*>
17991799
return NULL;
18001800
}
18011801

1802+
Py_DECREF(valueobj);
1803+
Py_DECREF(keyobj);
18021804
}
18031805

18041806
return d;
@@ -1997,9 +1999,7 @@ template <TYPE>
19971999
{
19982000
Py_DECREF(l);
19992001

2000-
if (tobj)
2001-
Py_DECREF(tobj);
2002-
else
2002+
if (!tobj)
20032003
delete t;
20042004

20052005
return NULL;
@@ -2073,8 +2073,6 @@ template <TYPE>
20732073

20742074
PyObject *keyobj = PyLong_FromLong(it.key());
20752075
PyObject *pyOobj = sipConvertFromType(oobj, sipType_QgsFeature, sipTransferObj);
2076-
PyDict_SetItem(d, keyobj, pyOobj);
2077-
20782076
if(pyOobj == NULL || keyobj == NULL || PyDict_SetItem(d, keyobj, pyOobj) < 0)
20792077
{
20802078
Py_DECREF(d);
@@ -2083,6 +2081,10 @@ template <TYPE>
20832081
{
20842082
Py_DECREF(pyOobj);
20852083
}
2084+
else
2085+
{
2086+
delete oobj;
2087+
}
20862088

20872089
if (keyobj)
20882090
{

0 commit comments

Comments
 (0)
Please sign in to comment.