summaryrefslogtreecommitdiffstats
path: root/libdimension/canvas.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdimension/canvas.c')
-rw-r--r--libdimension/canvas.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libdimension/canvas.c b/libdimension/canvas.c
index 1d74a33..eacd8f6 100644
--- a/libdimension/canvas.c
+++ b/libdimension/canvas.c
@@ -34,15 +34,15 @@ dmnsn_new_canvas(unsigned int x, unsigned int y)
canvas->x = x;
canvas->y = y;
+ /* Allocate room for the optimizers */
+ canvas->optimizers = dmnsn_new_array(sizeof(dmnsn_canvas_optimizer));
+
/* Allocate the pixels */
canvas->pixels = malloc(sizeof(dmnsn_color)*x*y);
if (!canvas->pixels) {
- free(canvas);
+ dmnsn_delete_canvas(canvas);
return NULL;
}
-
- /* Allocate room for the optimizers */
- canvas->optimizers = dmnsn_new_array(sizeof(dmnsn_canvas_optimizer));
}
return canvas;