Commits

illume committed 4f5abc2

Memory leak in a few modules. Thanks Lorenz Quack.

  • Participants
  • Parent commits a638b68

Comments (0)

Files changed (5)

 # BUG    = fixed a bug that was (or could have been) crashing
 #
 #
+
+[SVN 2366] Jun 17, 2009
+    [BUG] Memory leak in a few modules.  Thanks Lorenz Quack.
+
+[SVN 2365] Jun 16, 2009
+    Started to add basic slice support to Color type.
+
 [SVN 2311] Jun 4, 2009
     Fixed another Color regression... colors are now tasty again when pickled.
 
 {
     PyObject *colordict;
     PyObject *module;
-    PyObject *dict;
     PyObject *apiobj;
     static void* c_api[PYGAMEAPI_COLOR_NUMSLOTS];
     
         DECREF_MOD(module);
         MODINIT_ERROR;
     }
-    dict = PyModule_GetDict (module);
 
     c_api[0] = &PyColor_Type;
     c_api[1] = PyColor_New;
         DECREF_MOD(module);
         MODINIT_ERROR;
     }
-    if (PyDict_SetItemString (dict, PYGAMEAPI_LOCAL_ENTRY, apiobj)) {
+    if (PyModule_AddObject (module, PYGAMEAPI_LOCAL_ENTRY, apiobj)) {
+        Py_DECREF (apiobj);
         Py_DECREF (_COLORDICT);
         DECREF_MOD(module);
         MODINIT_ERROR;
     }
-    Py_DECREF (apiobj);
     MODINIT_RETURN (module);
 }
         MODINIT_ERROR;
     }
     if (PyModule_AddObject (module, PYGAMEAPI_LOCAL_ENTRY, apiobj) == -1) {
+        Py_DECREF (apiobj);
         DECREF_MOD (module);
         MODINIT_ERROR;
     }
         MODINIT_ERROR;
     }
     if (PyModule_AddObject (module, PYGAMEAPI_LOCAL_ENTRY, apiobj) == -1) {
+        Py_DECREF (apiobj);
         DECREF_MOD (module);
         MODINIT_ERROR;
     }

File src/pixelarray.c

     if (PyModule_AddObject (module, "PixelArray",
                             (PyObject *) &PyPixelArray_Type) == -1)
     {
+        Py_DECREF ((PyObject *) &PyPixelArray_Type);
         DECREF_MOD (module);
         MODINIT_ERROR;
     }