Kaydet (Commit) 105906ff authored tarafından Barry Warsaw's avatar Barry Warsaw

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.
üst 3879333b
...@@ -101,7 +101,7 @@ initerrno() ...@@ -101,7 +101,7 @@ initerrno()
m = Py_InitModule3("errno", errno_methods, errno__doc__); m = Py_InitModule3("errno", errno_methods, errno__doc__);
d = PyModule_GetDict(m); d = PyModule_GetDict(m);
de = PyDict_New(); 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"); Py_FatalError("can't initialize errno module");
/* Macro so I don't have to edit each and every line below... */ /* Macro so I don't have to edit each and every line below... */
...@@ -824,4 +824,5 @@ initerrno() ...@@ -824,4 +824,5 @@ initerrno()
inscode(d, ds, de, "WSAN", WSAN, "Error WSAN"); inscode(d, ds, de, "WSAN", WSAN, "Error WSAN");
#endif #endif
Py_DECREF(de);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment