diff --git a/rdtk/librdtk/rdtk_surface.c b/rdtk/librdtk/rdtk_surface.c index 2c02f8ea1..03e64e9e0 100644 --- a/rdtk/librdtk/rdtk_surface.c +++ b/rdtk/librdtk/rdtk_surface.c @@ -59,7 +59,10 @@ rdtkSurface* rdtk_surface_new(rdtkEngine* engine, BYTE* data, int width, int hei surface->data = (BYTE*) malloc(surface->scanline * surface->height); if (!surface->data) + { + free(surface); return NULL; + } ZeroMemory(surface->data, surface->scanline * surface->height);