Fixed memory leak.
authorArmin Novak <armin.novak@gmail.com>
Sun, 16 Nov 2014 23:55:25 +0000 (00:55 +0100)
committerArmin Novak <armin.novak@gmail.com>
Sun, 16 Nov 2014 23:55:25 +0000 (00:55 +0100)
rdtk/librdtk/rdtk_surface.c

index 2c02f8e..03e64e9 100644 (file)
@@ -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);