Lorenz Quack wrote:
Hi,
I found a series of minor memory leak. minor because they only occurs
in situations
where a call like PyDict_SetItemString of PyModule_AddObject fails
which means
things are already pretty bad anyway.
Nevertheless here is the bug description:
In "color.c" in the "MODINIT_DEFINE (color)" function at the end the
"apiobj"
leaks if the call to "PyDict_SetItemString" fails.
In "font.c" and "mask.c" the "apiobj" leaks if the call to
"PyModule_AddObject"
fails. Note that normally "PyModule_AddObject" steals a reference, but
it only
does so on success.
In "pixelarray.c" the leaking object is "PyPixelArray_Type" also with
the failing
call to "PyModule_AddObject".
I attached a patch.
yours
//Lorenz
Hi Lorenz,
Yes your right. I assumed that since PyModule_AddObject is documented as
stealing a reference, it always stole a reference. But in reality it
only does so conditionally, when it succeeds.
Lenard