summaryrefslogtreecommitdiff
path: root/common/gl_canvas.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2010-03-10 21:11:46 +0100
committerMarc-André Lureau <marcandre.lureau@gmail.com>2012-03-20 15:25:40 +0100
commit7653380e7e3ba4bf6593e473244b1d069f6ffbd3 (patch)
tree868e485d9b99296f598aa5f2bb3e131f4ed36fbd /common/gl_canvas.c
parent59b330b4d2fbfd410bf5ade59a7939017e9e3659 (diff)
Use the spice allocator in common/
Diffstat (limited to 'common/gl_canvas.c')
-rw-r--r--common/gl_canvas.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/common/gl_canvas.c b/common/gl_canvas.c
index c3c9388..f69c920 100644
--- a/common/gl_canvas.c
+++ b/common/gl_canvas.c
@@ -46,7 +46,7 @@ static inline uint8_t *copy_opposite_image(GLCanvas *canvas, void *data, int str
int i;
if (!canvas->private_data) {
- canvas->private_data = malloc(stride * height);
+ canvas->private_data = spice_malloc_n(height, stride);
if (!canvas->private_data) {
return ret_data;
}
@@ -55,7 +55,7 @@ static inline uint8_t *copy_opposite_image(GLCanvas *canvas, void *data, int str
if (canvas->private_data_size < (stride * height)) {
free(canvas->private_data);
- canvas->private_data = malloc(stride * height);
+ canvas->private_data = spice_malloc_n(height, stride);
if (!canvas->private_data) {
return ret_data;
}
@@ -742,7 +742,7 @@ static void gl_canvas_group_start(SpiceCanvas *spice_canvas, QRegion *region)
rects = pixman_region32_rectangles(region, &num_rect);
- glc_rects = (GLCRect *)malloc(num_rect * sizeof(GLCRect));
+ glc_rects = spice_new(GLCRect, num_rect);
now = glc_rects;
end = glc_rects + num_rect;
@@ -837,10 +837,10 @@ SpiceCanvas *gl_canvas_create(int width, int height, int depth
GLCanvas *canvas;
int init_ok;
- if (need_init || !(canvas = (GLCanvas *)malloc(sizeof(GLCanvas)))) {
+ if (need_init) {
return NULL;
}
- memset(canvas, 0, sizeof(GLCanvas));
+ canvas = spice_new0(GLCanvas, 1);
if (!(canvas->glc = glc_create(width, height))) {
goto error_1;