[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Refcounting Bugs



Hey, I was looking at Pygames source and noticed some refcounting errors that will leak memory.

This is from todays SVN


./src/font.c:473 - Py_BuildValue  has a ref and Append adds another
./src/font.c:489 - same as above
 - these are fairly bad because it runs in a loop.



./src/display.c:390
to...
./src/display.c:408
PyDict_SetItemString(dict, "window", PyInt_FromLong(info.info.x11.window));

This PyInt_FromLong starts with 1 refcount and PyDict_SetItemString adds another

use the utility function pygame has added- eg.
 insobj(dict, "gain", PyInt_FromLong(event->active.gain));
 - Not so bad because your not likely to run in a loop




append not decrefing either, these dont realy matter since your quitting anyhow but probably best to do it properly.
./src/base.c:95
./src/base.c:111



--
Campbell J Barton (ideasman42)