diff src/libgfx.c @ 929:e1378398be0f

Add size field for allocated data size in DMImage.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 25 Feb 2015 19:25:51 +0200
parents ebe0d93e03c0
children efbad8817b79
line wrap: on
line diff
--- a/src/libgfx.c	Wed Feb 25 15:50:17 2015 +0200
+++ b/src/libgfx.c	Wed Feb 25 19:25:51 2015 +0200
@@ -34,8 +34,8 @@
     
     img->width = img->pitch = width;
     img->height = height;
-    img->data = dmMalloc(width * height * sizeof(Uint8));
-    if (img->data == NULL)
+    img->size = width * height * sizeof(Uint8);
+    if ((img->data = dmMalloc(img->size)) == NULL)
     {
         dmFree(img);
         return NULL;