File: | meld3/cmeld3.c |
Function: | findmeld |
Error: | ob_refcnt of return value is 1 too low |
259 static PyObject*
260 findmeld(PyObject *node, PyObject *name) {
261 PyObject *attrib, *meldid, *result;
262 if (!(attrib = PyObject_GetAttr(node, PySTRattrib))) return NULL;
when treating unknown struct PyObject * from meld3/cmeld3.c:7 as non-NULL
when PyObject_GetAttr() succeeds
taking False path
263 meldid = PyDict_GetItem(attrib, PySTR_MELD_ID);
when treating unknown struct PyObject * from meld3/cmeld3.c:7 as non-NULL
when PyDict_GetItem() succeeds
264 Py_DECREF(attrib);
when taking False path
calling tp_dealloc on new ref from call to PyObject_GetAttr allocated at meld3/cmeld3.c:262
265
266 if (meldid != NULL) {
taking True path
267 int compareresult = PyUnicode_Compare(meldid, name);
268 if (compareresult == 0) {
when considering range: -0x80000000 <= value <= -1
taking False path
ob_refcnt is now refs: 0 + N where N >= 1
269 Py_INCREF(node);
270 return node;
271 }
272 }
273
274 int len, i;
275 result = Py_None;
276 PyObject *children = PyObject_GetAttr(node, PySTR_children);
when treating unknown struct PyObject * from meld3/cmeld3.c:6 as non-NULL
when PyObject_GetAttr() succeeds
277 len = PyList_Size(children);
when PyList_Size() returns ob_size
278 for (i = 0; i < len; i++) {
when considering range: -0x80000000 <= len <= 0
taking False path
279 PyObject *child = PyList_GetItem(children, i);
280 result = findmeld(child, name);
281 if (result != Py_None) {
282 break;
283 }
284 }
285 Py_DECREF(children);
when taking True path
286
287 return result;
288
289 }
ob_refcnt of return value is 1 too low
was expecting final ob_refcnt to be N + 1 (for some unknown N)
due to object being referenced by: return value
but final ob_refcnt is N + 0
consider using "Py_RETURN_NONE;"
found 5 similar trace(s) to this
File: | meld3/cmeld3.c |
Function: | findmeld |
Error: | calling PyList_Size with NULL as argument 1 (children) at meld3/cmeld3.c:277 |
259 static PyObject*
260 findmeld(PyObject *node, PyObject *name) {
261 PyObject *attrib, *meldid, *result;
262 if (!(attrib = PyObject_GetAttr(node, PySTRattrib))) return NULL;
when treating unknown struct PyObject * from meld3/cmeld3.c:7 as non-NULL
when PyObject_GetAttr() succeeds
taking False path
263 meldid = PyDict_GetItem(attrib, PySTR_MELD_ID);
when treating unknown struct PyObject * from meld3/cmeld3.c:7 as non-NULL
when PyDict_GetItem() succeeds
264 Py_DECREF(attrib);
when taking True path
265
266 if (meldid != NULL) {
taking True path
267 int compareresult = PyUnicode_Compare(meldid, name);
268 if (compareresult == 0) {
when considering range: -0x80000000 <= value <= -1
taking False path
269 Py_INCREF(node);
270 return node;
271 }
272 }
273
274 int len, i;
275 result = Py_None;
276 PyObject *children = PyObject_GetAttr(node, PySTR_children);
when treating unknown struct PyObject * from meld3/cmeld3.c:6 as non-NULL
when PyObject_GetAttr() fails
277 len = PyList_Size(children);
calling PyList_Size with NULL as argument 1 (children) at meld3/cmeld3.c:277
PyList_Size() invokes Py_TYPE() on the pointer via the PyList_Check() macro, thus accessing (NULL)->ob_type
found 1 similar trace(s) to this
278 for (i = 0; i < len; i++) {
279 PyObject *child = PyList_GetItem(children, i);
280 result = findmeld(child, name);
281 if (result != Py_None) {
282 break;
283 }
284 }
285 Py_DECREF(children);
286
287 return result;
288
289 }