Skip to content

Commit 105906f

Browse files
committed
initerrno(): Nailed a not-so-tiny memory leak. The de dictionary is
put into the module dict, but is never DECREF'd in this function, so it and all its contents leak.
1 parent 3879333 commit 105906f

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎Modules/errnomodule.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ initerrno()
101101
m = Py_InitModule3("errno", errno_methods, errno__doc__);
102102
d = PyModule_GetDict(m);
103103
de = PyDict_New();
104-
if (de == NULL || PyDict_SetItemString(d,"errorcode",de))
104+
if (de == NULL || PyDict_SetItemString(d, "errorcode", de))
105105
Py_FatalError("can't initialize errno module");
106106

107107
/* Macro so I don't have to edit each and every line below... */
@@ -824,4 +824,5 @@ initerrno()
824824
inscode(d, ds, de, "WSAN", WSAN, "Error WSAN");
825825
#endif
826826

827+
Py_DECREF(de);
827828
}

0 commit comments

Comments
 (0)