]> granicus.if.org Git - python/commitdiff
initerrno(): Nailed a not-so-tiny memory leak. The de dictionary is
authorBarry Warsaw <barry@python.org>
Wed, 27 Jan 1999 18:04:05 +0000 (18:04 +0000)
committerBarry Warsaw <barry@python.org>
Wed, 27 Jan 1999 18:04:05 +0000 (18:04 +0000)
put into the module dict, but is never DECREF'd in this function, so
it and all its contents leak.

Modules/errnomodule.c

index f18a6555ba0dc9e7899f982c98adc921ba5c4616..ee0aaf1d92338df47a999a50d31faece4186249a 100644 (file)
@@ -101,7 +101,7 @@ initerrno()
        m = Py_InitModule3("errno", errno_methods, errno__doc__);
        d = PyModule_GetDict(m);
        de = PyDict_New();
-       if (de == NULL || PyDict_SetItemString(d,"errorcode",de))
+       if (de == NULL || PyDict_SetItemString(d, "errorcode", de))
                Py_FatalError("can't initialize errno module");
 
 /* Macro so I don't have to edit each and every line below... */
@@ -824,4 +824,5 @@ initerrno()
        inscode(d, ds, de, "WSAN", WSAN, "Error WSAN");
 #endif
 
+       Py_DECREF(de);
 }