File: pylircmodule.c
Function: pylirc_nextcode
Error: ob_refcnt of new ref from call to Py_BuildValue is 1 too high
162 //
163 static PyObject * pylirc_nextcode(self, args)
164    PyObject *self;
165    PyObject *args; {
166 
167    char *code, *c;
168    PyObject *poTemp;
169    int intExtended = 0, intRepeatCount;
170    
171    // Get arguments
172    if (!PyArg_ParseTuple(args, "|i", &intExtended)) {
when PyArg_ParseTuple() succeeds
taking False path
173    
174       // I guess this one cannot fail, but for completeness
175       PyErr_SetString(PyExc_ValueError, "Wrong number of arguments!");
176       return NULL;
177    }
178    
179    // Returnvalue = 'None' (will change upon success)
180    poTemp =  Py_BuildValue("");
when Py_BuildValue() succeeds
new ref from call to Py_BuildValue allocated at:    poTemp =  Py_BuildValue("");
ob_refcnt is now refs: 1 + N where N >= 0
181 
182    // Check if there is anything in the queue
183    if(lirc_nextcode(&code) != -1) {
when considering range: -0x80000000 <= value <= -2
taking True path
184 
185       // If code isn't NULL...
186       if(code) {
when treating unknown char * * from pylircmodule.c:183 as non-NULL
taking True path
187 	
188 	// Translate the string from configfile
189 	lirc_code2char(config, code, &c);
190 	
191 	if (c) 
when treating unknown char * * from pylircmodule.c:189 as non-NULL
taking True path
192 	  {
193 	    // Returnvalue = empty list
194 	    poTemp = PyList_New(0);
when PyList_New() succeeds
195 	    
196 	    // If the list-creation was successful
197 	    if(poTemp) {
taking True path
198 	      
199 	      // If success...
200 	      while(c) {
taking True path
when treating unknown char * * from pylircmodule.c:222 as NULL
taking False path
201 		
202 		if(intExtended) {
when considering range: 1 <= value <= 0x7fffffff
taking True path
203 		  // Extended api - returns a list
204 		  // Thanks alot to Brian J. Murrell for the contribution!
205 		  
206                   // Extract the repeat value from the code
207                   if (sscanf(code, "%*llx %x %*s %*s\n", &intRepeatCount) != 1)
when considering range: -0x80000000 <= value <= 0
taking True path
208                      // some kind of error getting the repeat value, shouldnt happen...
209                      intRepeatCount = 0;
210                   
211                   // Append the read code and repeat tuple to the list
212                   PyList_Append(poTemp, Py_BuildValue("{s:s, s:i}", "config", c, "repeat", intRepeatCount));
when Py_BuildValue() succeeds
when PyList_Append() succeeds
213 
214                } else {
215                   // Old api
216                   
217                   // Appen the read code to the list
218                   PyList_Append(poTemp, Py_BuildValue("s", c));
219 		}
220 		
221 		// Read the next code
222 		lirc_code2char(config, code, &c);
223 	      }
224 	    }
225 	  }
226 	
227 	// Free the memory
228 	free(code);
229       }
230       
231 
232    }
233    // Return a list or 'None'
234    return poTemp;
235 
236 }
ob_refcnt of new ref from call to Py_BuildValue 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 21 similar trace(s) to this