diff options
author | Søren Sandmann <ssp@redhat.com> | 2012-08-21 12:59:53 -0400 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@redhat.com> | 2012-08-23 17:49:49 -0400 |
commit | 9f107f2208448d450e66f3f43aee7d031454d3e7 (patch) | |
tree | a2e9341029d26f48b8aba534325ff08294e6466e | |
parent | f81be0914b8208f99bdfce5685b54db15fa05af1 (diff) |
plug leaks
-rw-r--r-- | src/qxl_driver.c | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/src/qxl_driver.c b/src/qxl_driver.c index 5d932a7..fa0ea8d 100644 --- a/src/qxl_driver.c +++ b/src/qxl_driver.c @@ -339,14 +339,14 @@ qxl_garbage_collect_internal (qxl_screen_t *qxl, uint64_t id) int is_cursor = FALSE; int is_surface = FALSE; int is_drawable = FALSE; - + if ((id & POINTER_MASK) == 1) is_cursor = TRUE; else if ((id & POINTER_MASK) == 2) is_surface = TRUE; else is_drawable = TRUE; - + if (is_cursor && cmd->type == QXL_CURSOR_SET) { struct QXLCursor *cursor = (void *)virtual_address ( @@ -358,7 +358,7 @@ qxl_garbage_collect_internal (qxl_screen_t *qxl, uint64_t id) { struct QXLImage *image = virtual_address ( qxl, u64_to_pointer (drawable->u.copy.src_bitmap), qxl->main_mem_slot); - + if (image->descriptor.type == SPICE_IMAGE_TYPE_SURFACE) { qxl_surface_unref (qxl->surface_cache, image->surface_image.surface_id); @@ -370,16 +370,50 @@ qxl_garbage_collect_internal (qxl_screen_t *qxl, uint64_t id) qxl_image_destroy (qxl, image); } } + else if (is_drawable && drawable->type == QXL_DRAW_COMPOSITE) + { + struct QXLTransform *src_trans, *mask_trans; + struct QXLImage *src_img, *mask_img; + struct QXLComposite *composite = &drawable->u.composite; + + /* Source */ + src_img = virtual_address ( + qxl, u64_to_pointer (drawable->u.composite.src), qxl->main_mem_slot); + qxl_free (qxl->mem, src_img, "image struct"); + + if (composite->src_transform) + { + src_trans = virtual_address ( + qxl, u64_to_pointer (composite->src_transform), qxl->main_mem_slot); + qxl_free (qxl->mem, src_trans, "transform"); + } + + /* Mask */ + if (drawable->u.composite.mask) + { + if (drawable->u.composite.mask_transform) + { + mask_trans = virtual_address ( + qxl, u64_to_pointer (drawable->u.composite.mask_transform), qxl->main_mem_slot); + + qxl_free (qxl->mem, mask_trans, "transform"); + } + + mask_img = virtual_address ( + qxl, u64_to_pointer (drawable->u.composite.mask), qxl->main_mem_slot); + qxl_free (qxl->mem, mask_img, "image struct"); + } + } else if (is_surface && surface_cmd->type == QXL_SURFACE_CMD_DESTROY) { qxl_surface_recycle (qxl->surface_cache, surface_cmd->surface_id); qxl_surface_cache_sanity_check (qxl->surface_cache); } - + id = info->next; - + qxl_free (qxl->mem, info, "command"); - + return id; } |