[sourcescanner] Plug a couple of python leaks
authorJohan Dahlin <johan@gnome.org>
Sun, 26 Sep 2010 15:37:19 +0000 (12:37 -0300)
committerJohan Dahlin <johan@gnome.org>
Sun, 26 Sep 2010 15:37:19 +0000 (12:37 -0300)
There's no need to increase the reference count to
items passed into PyList_SetItem, it already steals a reference.

giscanner/giscannermodule.c

index de65d6f3cb0ae1379ad9859ddcac29be789d0cbc..aea9d907f0da33c3b08077295f2c63705432de23 100644 (file)
@@ -299,7 +299,6 @@ type_get_child_list (PyGISourceType *self,
     {
       PyObject *item = pygi_source_symbol_new (l->data);
       PyList_SetItem (list, i++, item);
-      Py_INCREF (item);
     }
 
   Py_INCREF (list);
@@ -512,7 +511,6 @@ pygi_source_scanner_get_symbols (PyGISourceScanner *self)
     {
       PyObject *item = pygi_source_symbol_new (l->data);
       PyList_SetItem (list, i++, item);
-      Py_INCREF (item);
     }
 
   Py_INCREF (list);
@@ -535,8 +533,7 @@ pygi_source_scanner_get_comments (PyGISourceScanner *self)
       PyObject *item = Py_BuildValue ("(ssi)", comment->comment,
                                       comment->filename,
                                       comment->line);
-      PyList_SET_ITEM (list, i++, item);
-      Py_INCREF (item);
+      PyList_SetItem (list, i++, item);
     }
 
   Py_INCREF (list);