commit bb06429
Michael Forney
·
2014-01-15 12:47:32 +0000 UTC
parent d611113
pixman: Handle image creation failure
1 files changed,
+4,
-2
M
pixman.c
M
pixman.c
+4,
-2
1@@ -198,20 +198,22 @@ static pixman_image_t * pixman_image(struct wld_buffer * buffer)
2 image = pixman_image_create_bits(format_wld_to_pixman(buffer->format),
3 buffer->width, buffer->height,
4 buffer->map.data, buffer->pitch);
5- pixman_image_set_destroy_function(image, &destroy_image, buffer);
6
7 if (!image)
8 goto error1;
9
10 if (!(exporter = malloc(sizeof *exporter)))
11- return NULL;
12+ goto error2;
13
14 exporter_initialize(&exporter->base, &exporter_impl);
15 exporter->image = image;
16 buffer_add_exporter(buffer, &exporter->base);
17+ pixman_image_set_destroy_function(image, &destroy_image, buffer);
18
19 return pixman_image_ref(image);
20
21+ error2:
22+ pixman_image_unref(image);
23 error1:
24 wld_unmap(buffer);
25 error0: