File: src/python/pyhbac.c
Function: sequence_as_string_list
Error: ob_refcnt of '*item' is 1 too high
109 static const char **
110 sequence_as_string_list(PyObject *seq, const char *paramname)
111 {
112     const char *p = paramname ? paramname : "attribute values";
when taking True path
113     const char **ret;
114     PyObject *utf_item;
115     int i;
116     Py_ssize_t len;
117     PyObject *item;
118 
119     if (!PySequence_Check(seq)) {
when considering range: -0x80000000 <= value <= -1
taking False path
120         PyErr_Format(PyExc_TypeError,
121                      "The object must be a sequence\n");
122         return NULL;
123     }
124 
125     len = PySequence_Size(seq);
126     if (len == -1) return NULL;
when considering range: 0 <= value <= 0x7fffffffffffffff
taking False path
127 
128     ret = PyMem_New(const char *, (len+1));
when considering range: 1 <= value <= 0xfffffffffffffff
taking True path
when PyMem_Malloc() succeeds
129     if (!ret) {
taking False path
130         PyErr_NoMemory();
131         return NULL;
132     }
133 
134     for (i = 0; i < len; i++) {
when considering range: 1 <= value <= 0x7fffffffffffffff
taking True path
when considering value == (Py_ssize_t)1 from src/python/pyhbac.c:125
taking False path
135         item = PySequence_GetItem(seq, i);
when PySequence_GetItem() succeeds
new ref from PySequence_GetItem allocated at:         item = PySequence_GetItem(seq, i);
ob_refcnt is now refs: 1 + N where N >= 0
136         if (item == NULL) {
taking False path
137             break;
138         }
139 
140         utf_item = get_utf8_string(item, p);
when get_utf8_string() succeeds
141         if (utf_item == NULL) {
taking False path
142             return NULL;
143         }
144 
145         ret[i] = py_strdup(PyString_AsString(utf_item));
when PyString_AsString() succeeds
146         Py_DECREF(utf_item);
when taking True path
147         if (!ret[i]) {
when treating unknown char * from src/python/pyhbac.c:145 as non-NULL
taking False path
148             return NULL;
149         }
150     }
151 
152     ret[i] = NULL;
153     return ret;
154 }
ob_refcnt of '*item' 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 8 similar trace(s) to this