File: meld3/cmeld3.c
Function: bfclone
Error: ob_refcnt of return value is 1 too low
13 static PyObject*
14 bfclone(PyObject *nodes, PyObject *parent)
15 {
16     int len, i;
17 
18     if (!(PyList_Check(nodes))) {
when considering range: 1 <= value <= 0x2000000
taking False path
19 	return NULL;
20     }
21 
22     len = PyList_Size(nodes);
when PyList_Size() returns ob_size
23 
24     if (len < 0) {
when considering range: 0 <= value <= 0x7fffffff
taking False path
25 	return NULL;
26     }
27 
28     PyObject *L;
29     if (!(L = PyList_New(0))) return NULL;
when PyList_New() succeeds
taking False path
30 
31     for (i = 0; i < len; i++) {
when considering range: 1 <= len <= 0x7fffffff
taking True path
when considering len == (int)1 from meld3/cmeld3.c:22
taking False path
32 
33 	PyObject *node;
34 
35 	if (!(node = PyList_GetItem(nodes, i))) {
taking False path
36 	    return NULL;
37 	}
38 
39 	PyObject *klass;
40 	PyObject *children;
41 	PyObject *text;
42 	PyObject *tail;
43 	PyObject *tag;
44 	PyObject *attrib;
45 	PyObject *structure;
46 	PyObject *dict;
47 	PyObject *newdict;
48 	PyObject *newchildren;
49 	PyObject *attrib_copy;
50 	PyObject *element;
51 	int childsize;
52 
53 	if (!(klass = PyObject_GetAttr(node, PySTR__class__))) return NULL;
when treating unknown struct PyObject * from meld3/cmeld3.c:6 as non-NULL
when PyObject_GetAttr() succeeds
taking False path
54 	if (!(dict = PyObject_GetAttr(node, PySTR__dict__))) return NULL;
when treating unknown struct PyObject * from meld3/cmeld3.c:6 as non-NULL
when PyObject_GetAttr() succeeds
taking False path
55 
56 	if (!(children = PyDict_GetItem(dict, PySTR_children))) return NULL;
when treating unknown struct PyObject * from meld3/cmeld3.c:6 as non-NULL
when PyDict_GetItem() succeeds
taking False path
57 	if (!(tag = PyDict_GetItem(dict, PySTRtag))) return NULL;
when treating unknown struct PyObject * from meld3/cmeld3.c:8 as non-NULL
when PyDict_GetItem() succeeds
taking False path
58 	if (!(attrib = PyDict_GetItem(dict, PySTRattrib))) return NULL;
when treating unknown struct PyObject * from meld3/cmeld3.c:7 as non-NULL
when PyDict_GetItem() succeeds
taking False path
59 
60 	if (!(text = PyDict_GetItem(dict, PySTRtext))) {
when treating unknown struct PyObject * from meld3/cmeld3.c:8 as non-NULL
when PyDict_GetItem() succeeds
taking False path
61 	    text = Py_None;
62 	}
63 	if (!(tail = PyDict_GetItem(dict, PySTRtail))) {
when treating unknown struct PyObject * from meld3/cmeld3.c:8 as non-NULL
when PyDict_GetItem() succeeds
taking False path
64 	    tail = Py_None;
65 	}
66 	if (!(structure = PyDict_GetItem(dict, PySTRstructure))) {
when treating unknown struct PyObject * from meld3/cmeld3.c:8 as non-NULL
when PyDict_GetItem() succeeds
taking False path
67 	    structure = Py_None;
68 	}
69 	Py_DECREF(dict);
when taking True path
70 
71 	if (!(newdict = PyDict_New())) return NULL;
when PyDict_New() succeeds
taking False path
72 	if (!(newchildren = PyList_New(0))) return NULL;
when PyList_New() succeeds
taking False path
73 
74 	attrib_copy = PyDict_Copy(attrib);
when PyDict_Copy() succeeds
75 
76 	PyDict_SetItem(newdict, PySTR_children, newchildren);
when PyDict_SetItem() succeeds
77         Py_DECREF(newchildren);
taking True path
78 	PyDict_SetItem(newdict, PySTRattrib, attrib_copy);
when PyDict_SetItem() succeeds
79         Py_DECREF(attrib_copy);
taking True path
80 	PyDict_SetItem(newdict, PySTRtext, text);
when PyDict_SetItem() succeeds
81 	PyDict_SetItem(newdict, PySTRtail, tail);
when PyDict_SetItem() succeeds
82 	PyDict_SetItem(newdict, PySTRtag, tag);
when PyDict_SetItem() succeeds
83 	PyDict_SetItem(newdict, PySTRstructure, structure);
when PyDict_SetItem() succeeds
84 	PyDict_SetItem(newdict, PySTRparent, parent);
when treating unknown struct PyObject * from meld3/cmeld3.c:7 as non-NULL
when PyDict_SetItem() succeeds
ob_refcnt is now refs: 0 + N where N >= 2
85     
86 	if (!(element = PyInstance_NewRaw(klass, newdict))) {
when PyInstance_NewRaw() succeeds
taking False path
87 	    return NULL;
88 	}
89 
90         Py_DECREF(newdict);
when taking True path
91 	Py_DECREF(klass);
when taking True path
92  
93 	if (PyList_Append(L, element)) {
when PyList_Append() succeeds
taking False path
94 	    return NULL;
95 	}
96         Py_DECREF(element);
taking True path
97 
98 	if (!PyList_Check(children)) return NULL;
when considering range: 1 <= value <= 0x2000000
taking False path
99 
100 	if ((childsize = PyList_Size(children)) < 0) {
when PyList_Size() returns ob_size
when considering range: 0 <= value <= 0x7fffffff
taking False path
101 	    return NULL;
102 	}
103 	else {
104 	    if (childsize > 0) {
when considering range: 1 <= value <= 0x7fffffff
taking True path
105 		bfclone(children, element);
when bfclone() fails
106 	    }
107 	}
108     }
109 
110     if (PyObject_SetAttr(parent, PySTR_children, L)) return NULL;
when PyObject_SetAttr() succeeds
taking False path
111     Py_DECREF(L);
when taking True path
112     return parent;
113 
114 }
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
found 7 similar trace(s) to this

File: meld3/cmeld3.c
Function: bfclone
Error: ob_refcnt of new ref from (unknown) bfclone is 1 too high
13 static PyObject*
14 bfclone(PyObject *nodes, PyObject *parent)
15 {
16     int len, i;
17 
18     if (!(PyList_Check(nodes))) {
when considering range: 1 <= value <= 0x2000000
taking False path
19 	return NULL;
20     }
21 
22     len = PyList_Size(nodes);
when PyList_Size() returns ob_size
23 
24     if (len < 0) {
when considering range: 0 <= value <= 0x7fffffff
taking False path
25 	return NULL;
26     }
27 
28     PyObject *L;
29     if (!(L = PyList_New(0))) return NULL;
when PyList_New() succeeds
taking False path
30 
31     for (i = 0; i < len; i++) {
when considering range: 1 <= len <= 0x7fffffff
taking True path
when considering len == (int)1 from meld3/cmeld3.c:22
taking False path
32 
33 	PyObject *node;
34 
35 	if (!(node = PyList_GetItem(nodes, i))) {
taking False path
36 	    return NULL;
37 	}
38 
39 	PyObject *klass;
40 	PyObject *children;
41 	PyObject *text;
42 	PyObject *tail;
43 	PyObject *tag;
44 	PyObject *attrib;
45 	PyObject *structure;
46 	PyObject *dict;
47 	PyObject *newdict;
48 	PyObject *newchildren;
49 	PyObject *attrib_copy;
50 	PyObject *element;
51 	int childsize;
52 
53 	if (!(klass = PyObject_GetAttr(node, PySTR__class__))) return NULL;
when treating unknown struct PyObject * from meld3/cmeld3.c:6 as non-NULL
when PyObject_GetAttr() succeeds
taking False path
54 	if (!(dict = PyObject_GetAttr(node, PySTR__dict__))) return NULL;
when treating unknown struct PyObject * from meld3/cmeld3.c:6 as non-NULL
when PyObject_GetAttr() succeeds
taking False path
55 
56 	if (!(children = PyDict_GetItem(dict, PySTR_children))) return NULL;
when treating unknown struct PyObject * from meld3/cmeld3.c:6 as non-NULL
when PyDict_GetItem() succeeds
taking False path
57 	if (!(tag = PyDict_GetItem(dict, PySTRtag))) return NULL;
when treating unknown struct PyObject * from meld3/cmeld3.c:8 as non-NULL
when PyDict_GetItem() succeeds
taking False path
58 	if (!(attrib = PyDict_GetItem(dict, PySTRattrib))) return NULL;
when treating unknown struct PyObject * from meld3/cmeld3.c:7 as non-NULL
when PyDict_GetItem() succeeds
taking False path
59 
60 	if (!(text = PyDict_GetItem(dict, PySTRtext))) {
when treating unknown struct PyObject * from meld3/cmeld3.c:8 as non-NULL
when PyDict_GetItem() succeeds
taking False path
61 	    text = Py_None;
62 	}
63 	if (!(tail = PyDict_GetItem(dict, PySTRtail))) {
when treating unknown struct PyObject * from meld3/cmeld3.c:8 as non-NULL
when PyDict_GetItem() succeeds
taking False path
64 	    tail = Py_None;
65 	}
66 	if (!(structure = PyDict_GetItem(dict, PySTRstructure))) {
when treating unknown struct PyObject * from meld3/cmeld3.c:8 as non-NULL
when PyDict_GetItem() succeeds
taking False path
67 	    structure = Py_None;
68 	}
69 	Py_DECREF(dict);
when taking True path
70 
71 	if (!(newdict = PyDict_New())) return NULL;
when PyDict_New() succeeds
taking False path
72 	if (!(newchildren = PyList_New(0))) return NULL;
when PyList_New() succeeds
taking False path
73 
74 	attrib_copy = PyDict_Copy(attrib);
when PyDict_Copy() succeeds
75 
76 	PyDict_SetItem(newdict, PySTR_children, newchildren);
when PyDict_SetItem() succeeds
77         Py_DECREF(newchildren);
taking True path
78 	PyDict_SetItem(newdict, PySTRattrib, attrib_copy);
when PyDict_SetItem() succeeds
79         Py_DECREF(attrib_copy);
taking True path
80 	PyDict_SetItem(newdict, PySTRtext, text);
when PyDict_SetItem() succeeds
81 	PyDict_SetItem(newdict, PySTRtail, tail);
when PyDict_SetItem() succeeds
82 	PyDict_SetItem(newdict, PySTRtag, tag);
when PyDict_SetItem() succeeds
83 	PyDict_SetItem(newdict, PySTRstructure, structure);
when PyDict_SetItem() succeeds
84 	PyDict_SetItem(newdict, PySTRparent, parent);
when treating unknown struct PyObject * from meld3/cmeld3.c:7 as non-NULL
when PyDict_SetItem() succeeds
85     
86 	if (!(element = PyInstance_NewRaw(klass, newdict))) {
when PyInstance_NewRaw() succeeds
taking False path
87 	    return NULL;
88 	}
89 
90         Py_DECREF(newdict);
when taking True path
91 	Py_DECREF(klass);
when taking True path
92  
93 	if (PyList_Append(L, element)) {
when PyList_Append() succeeds
taking False path
94 	    return NULL;
95 	}
96         Py_DECREF(element);
taking True path
97 
98 	if (!PyList_Check(children)) return NULL;
when considering range: 1 <= value <= 0x2000000
taking False path
99 
100 	if ((childsize = PyList_Size(children)) < 0) {
when PyList_Size() returns ob_size
when considering range: 0 <= value <= 0x7fffffff
taking False path
101 	    return NULL;
102 	}
103 	else {
104 	    if (childsize > 0) {
when considering range: 1 <= value <= 0x7fffffff
taking True path
105 		bfclone(children, element);
when bfclone() succeeds
new ref from (unknown) bfclone allocated at: 		bfclone(children, element);
ob_refcnt is now refs: 1 + N where N >= 0
106 	    }
107 	}
108     }
109 
110     if (PyObject_SetAttr(parent, PySTR_children, L)) return NULL;
when PyObject_SetAttr() succeeds
taking False path
111     Py_DECREF(L);
when taking True path
112     return parent;
113 
114 }
ob_refcnt of new ref from (unknown) bfclone is 1 too high
was expecting final ob_refcnt to be N + 0 (for some unknown N)
but final ob_refcnt is N + 1
found 2 similar trace(s) to this

File: meld3/cmeld3.c
Function: bfclone
Error: ob_refcnt of '*L' is 1 too high
13 static PyObject*
14 bfclone(PyObject *nodes, PyObject *parent)
15 {
16     int len, i;
17 
18     if (!(PyList_Check(nodes))) {
when considering range: 1 <= value <= 0x2000000
taking False path
19 	return NULL;
20     }
21 
22     len = PyList_Size(nodes);
when PyList_Size() returns ob_size
23 
24     if (len < 0) {
when considering range: 0 <= value <= 0x7fffffff
taking False path
25 	return NULL;
26     }
27 
28     PyObject *L;
29     if (!(L = PyList_New(0))) return NULL;
when PyList_New() succeeds
taking False path
PyListObject allocated at:     if (!(L = PyList_New(0))) return NULL;
ob_refcnt is now refs: 1 + N where N >= 0
30 
31     for (i = 0; i < len; i++) {
when considering range: 1 <= len <= 0x7fffffff
taking True path
when considering len == (int)1 from meld3/cmeld3.c:22
taking False path
32 
33 	PyObject *node;
34 
35 	if (!(node = PyList_GetItem(nodes, i))) {
taking False path
36 	    return NULL;
37 	}
38 
39 	PyObject *klass;
40 	PyObject *children;
41 	PyObject *text;
42 	PyObject *tail;
43 	PyObject *tag;
44 	PyObject *attrib;
45 	PyObject *structure;
46 	PyObject *dict;
47 	PyObject *newdict;
48 	PyObject *newchildren;
49 	PyObject *attrib_copy;
50 	PyObject *element;
51 	int childsize;
52 
53 	if (!(klass = PyObject_GetAttr(node, PySTR__class__))) return NULL;
when treating unknown struct PyObject * from meld3/cmeld3.c:6 as non-NULL
when PyObject_GetAttr() succeeds
taking False path
54 	if (!(dict = PyObject_GetAttr(node, PySTR__dict__))) return NULL;
when treating unknown struct PyObject * from meld3/cmeld3.c:6 as non-NULL
when PyObject_GetAttr() succeeds
taking False path
55 
56 	if (!(children = PyDict_GetItem(dict, PySTR_children))) return NULL;
when treating unknown struct PyObject * from meld3/cmeld3.c:6 as non-NULL
when PyDict_GetItem() succeeds
taking False path
57 	if (!(tag = PyDict_GetItem(dict, PySTRtag))) return NULL;
when treating unknown struct PyObject * from meld3/cmeld3.c:8 as non-NULL
when PyDict_GetItem() succeeds
taking False path
58 	if (!(attrib = PyDict_GetItem(dict, PySTRattrib))) return NULL;
when treating unknown struct PyObject * from meld3/cmeld3.c:7 as non-NULL
when PyDict_GetItem() succeeds
taking False path
59 
60 	if (!(text = PyDict_GetItem(dict, PySTRtext))) {
when treating unknown struct PyObject * from meld3/cmeld3.c:8 as non-NULL
when PyDict_GetItem() succeeds
taking False path
61 	    text = Py_None;
62 	}
63 	if (!(tail = PyDict_GetItem(dict, PySTRtail))) {
when treating unknown struct PyObject * from meld3/cmeld3.c:8 as non-NULL
when PyDict_GetItem() succeeds
taking False path
64 	    tail = Py_None;
65 	}
66 	if (!(structure = PyDict_GetItem(dict, PySTRstructure))) {
when treating unknown struct PyObject * from meld3/cmeld3.c:8 as non-NULL
when PyDict_GetItem() succeeds
taking False path
67 	    structure = Py_None;
68 	}
69 	Py_DECREF(dict);
when taking True path
70 
71 	if (!(newdict = PyDict_New())) return NULL;
when PyDict_New() succeeds
taking False path
72 	if (!(newchildren = PyList_New(0))) return NULL;
when PyList_New() succeeds
taking False path
73 
74 	attrib_copy = PyDict_Copy(attrib);
when PyDict_Copy() succeeds
75 
76 	PyDict_SetItem(newdict, PySTR_children, newchildren);
when PyDict_SetItem() succeeds
77         Py_DECREF(newchildren);
taking True path
78 	PyDict_SetItem(newdict, PySTRattrib, attrib_copy);
when PyDict_SetItem() succeeds
79         Py_DECREF(attrib_copy);
taking True path
80 	PyDict_SetItem(newdict, PySTRtext, text);
when PyDict_SetItem() succeeds
81 	PyDict_SetItem(newdict, PySTRtail, tail);
when PyDict_SetItem() succeeds
82 	PyDict_SetItem(newdict, PySTRtag, tag);
when PyDict_SetItem() succeeds
83 	PyDict_SetItem(newdict, PySTRstructure, structure);
when PyDict_SetItem() succeeds
84 	PyDict_SetItem(newdict, PySTRparent, parent);
when treating unknown struct PyObject * from meld3/cmeld3.c:7 as non-NULL
when PyDict_SetItem() succeeds
85     
86 	if (!(element = PyInstance_NewRaw(klass, newdict))) {
when PyInstance_NewRaw() succeeds
taking False path
87 	    return NULL;
88 	}
89 
90         Py_DECREF(newdict);
when taking True path
91 	Py_DECREF(klass);
when taking True path
92  
93 	if (PyList_Append(L, element)) {
when PyList_Append() succeeds
taking False path
94 	    return NULL;
95 	}
96         Py_DECREF(element);
taking True path
97 
98 	if (!PyList_Check(children)) return NULL;
when considering range: 1 <= value <= 0x2000000
taking False path
99 
100 	if ((childsize = PyList_Size(children)) < 0) {
when PyList_Size() returns ob_size
when considering range: 0 <= value <= 0x7fffffff
taking False path
101 	    return NULL;
102 	}
103 	else {
104 	    if (childsize > 0) {
when considering range: 1 <= value <= 0x7fffffff
taking True path
105 		bfclone(children, element);
when bfclone() succeeds
106 	    }
107 	}
108     }
109 
110     if (PyObject_SetAttr(parent, PySTR_children, L)) return NULL;
when PyObject_SetAttr() fails
taking True path
111     Py_DECREF(L);
112     return parent;
113 
114 }
ob_refcnt of '*L' is 1 too high
was expecting final ob_refcnt to be N + 0 (for some unknown N)
but final ob_refcnt is N + 1
found 4 similar trace(s) to this

File: meld3/cmeld3.c
Function: bfclone
Error: returning (PyObject*)NULL without setting an exception
13 static PyObject*
14 bfclone(PyObject *nodes, PyObject *parent)
15 {
16     int len, i;
17 
18     if (!(PyList_Check(nodes))) {
when considering range: 1 <= value <= 0x2000000
taking False path
19 	return NULL;
20     }
21 
22     len = PyList_Size(nodes);
when PyList_Size() returns ob_size
23 
24     if (len < 0) {
when considering range: 0 <= value <= 0x7fffffff
taking False path
25 	return NULL;
26     }
27 
28     PyObject *L;
29     if (!(L = PyList_New(0))) return NULL;
when PyList_New() succeeds
taking False path
30 
31     for (i = 0; i < len; i++) {
when considering range: 1 <= len <= 0x7fffffff
taking True path
32 
33 	PyObject *node;
34 
35 	if (!(node = PyList_GetItem(nodes, i))) {
taking False path
36 	    return NULL;
37 	}
38 
39 	PyObject *klass;
40 	PyObject *children;
41 	PyObject *text;
42 	PyObject *tail;
43 	PyObject *tag;
44 	PyObject *attrib;
45 	PyObject *structure;
46 	PyObject *dict;
47 	PyObject *newdict;
48 	PyObject *newchildren;
49 	PyObject *attrib_copy;
50 	PyObject *element;
51 	int childsize;
52 
53 	if (!(klass = PyObject_GetAttr(node, PySTR__class__))) return NULL;
when treating unknown struct PyObject * from meld3/cmeld3.c:6 as non-NULL
when PyObject_GetAttr() succeeds
taking False path
54 	if (!(dict = PyObject_GetAttr(node, PySTR__dict__))) return NULL;
when treating unknown struct PyObject * from meld3/cmeld3.c:6 as non-NULL
when PyObject_GetAttr() succeeds
taking False path
55 
56 	if (!(children = PyDict_GetItem(dict, PySTR_children))) return NULL;
when treating unknown struct PyObject * from meld3/cmeld3.c:6 as non-NULL
when PyDict_GetItem() succeeds
taking False path
57 	if (!(tag = PyDict_GetItem(dict, PySTRtag))) return NULL;
when treating unknown struct PyObject * from meld3/cmeld3.c:8 as non-NULL
when PyDict_GetItem() succeeds
taking False path
58 	if (!(attrib = PyDict_GetItem(dict, PySTRattrib))) return NULL;
when treating unknown struct PyObject * from meld3/cmeld3.c:7 as non-NULL
when PyDict_GetItem() succeeds
taking False path
59 
60 	if (!(text = PyDict_GetItem(dict, PySTRtext))) {
when treating unknown struct PyObject * from meld3/cmeld3.c:8 as non-NULL
when PyDict_GetItem() succeeds
taking False path
61 	    text = Py_None;
62 	}
63 	if (!(tail = PyDict_GetItem(dict, PySTRtail))) {
when treating unknown struct PyObject * from meld3/cmeld3.c:8 as non-NULL
when PyDict_GetItem() succeeds
taking False path
64 	    tail = Py_None;
65 	}
66 	if (!(structure = PyDict_GetItem(dict, PySTRstructure))) {
when treating unknown struct PyObject * from meld3/cmeld3.c:8 as non-NULL
when PyDict_GetItem() succeeds
taking False path
67 	    structure = Py_None;
68 	}
69 	Py_DECREF(dict);
when taking True path
70 
71 	if (!(newdict = PyDict_New())) return NULL;
when PyDict_New() succeeds
taking False path
72 	if (!(newchildren = PyList_New(0))) return NULL;
when PyList_New() succeeds
taking False path
73 
74 	attrib_copy = PyDict_Copy(attrib);
when PyDict_Copy() succeeds
75 
76 	PyDict_SetItem(newdict, PySTR_children, newchildren);
when PyDict_SetItem() succeeds
77         Py_DECREF(newchildren);
taking True path
78 	PyDict_SetItem(newdict, PySTRattrib, attrib_copy);
when PyDict_SetItem() succeeds
79         Py_DECREF(attrib_copy);
taking True path
80 	PyDict_SetItem(newdict, PySTRtext, text);
when PyDict_SetItem() succeeds
81 	PyDict_SetItem(newdict, PySTRtail, tail);
when PyDict_SetItem() succeeds
82 	PyDict_SetItem(newdict, PySTRtag, tag);
when PyDict_SetItem() succeeds
83 	PyDict_SetItem(newdict, PySTRstructure, structure);
when PyDict_SetItem() succeeds
84 	PyDict_SetItem(newdict, PySTRparent, parent);
when treating unknown struct PyObject * from meld3/cmeld3.c:7 as non-NULL
when PyDict_SetItem() succeeds
85     
86 	if (!(element = PyInstance_NewRaw(klass, newdict))) {
when PyInstance_NewRaw() succeeds
taking False path
87 	    return NULL;
88 	}
89 
90         Py_DECREF(newdict);
when taking True path
91 	Py_DECREF(klass);
when taking True path
92  
93 	if (PyList_Append(L, element)) {
when PyList_Append() succeeds
taking False path
94 	    return NULL;
95 	}
96         Py_DECREF(element);
taking True path
97 
98 	if (!PyList_Check(children)) return NULL;
when considering range: 1 <= value <= 0x2000000
taking False path
99 
100 	if ((childsize = PyList_Size(children)) < 0) {
when PyList_Size() returns ob_size
when considering range: -0x80000000 <= value <= -1
taking True path
101 	    return NULL;
102 	}
103 	else {
104 	    if (childsize > 0) {
105 		bfclone(children, element);
106 	    }
107 	}
108     }
109 
110     if (PyObject_SetAttr(parent, PySTR_children, L)) return NULL;
111     Py_DECREF(L);
112     return parent;
113 
114 }
returning (PyObject*)NULL without setting an exception
found 3 similar trace(s) to this