[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[pygame] A question...



In the load method for image I find the following code with the troubling
sequence of action

-> allocate some data dynamically put it in surf
-> return new_object_built from surf

My question is as PySurface_New does not deallocate the surface passed as a
parameter
if the allocation of the Python object for the surface fails, we are going
to have a memory leak
aren't we?

Guillaume


static PyObject* load(PyObject* self, PyObject* arg)
{
[...]
  surf = IMG_Load(name);
[...]
  surf = IMG_LoadTyped_RW(rw, 1, find_extension(name));
[...]
 return PySurface_New(surf);
}


____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org